revealed_comparative_advantage: Revealed Comparative Advantage (RCA)
Description
Revealed Comparative Advantage (RCA)
Usage
revealed_comparative_advantage(trade_data = NULL, country = "country",
product = "product", value = "value", cutoff = 1,
discrete = TRUE, tbl_output = FALSE)
Arguments
trade_data
tibble/data.frame in long format, it must contain the columns country (character/factor),
product (character/factor) and export value (numeric)
country
string to indicate the column that contains exporting countries (e.g. "reporter_iso")
product
string to indicate the column that contains exported products (e.g. "product_code")
value
string to indicate the column that contains traded values (e.g. "trade_value_usd")
cutoff
when set to TRUE all the values lower than the specified cutoff will be
converted to zero and to one in other case, numeric (default set to 1)
discrete
when set to TRUE it will convert all the Revealed Comparative Advantage values
to zero or one based on the cutoff value (default set to TRUE)
tbl_output
when set to TRUE the output will be a tibble instead of a matrix (default set to FALSE)
References
For more information on revealed comparative advantage and its uses see:
atlas2014economiccomplexity
Examples
Run this code# NOT RUN {
revealed_comparative_advantage(
trade_data = services_trade_2016$services_trade_2016_matrix,
tbl_output = TRUE
)
# }
Run the code above in your browser using DataLab