Title: | IO-PS Framework Package |
---|---|
Description: | A developmental R tool related to the input-output product space (IO-PS). The package requires two compulsory user inputs (raw CEPPI BACI trade data, and any acceptable ISO country code) and has 4 optional user inputs (a value chain map, chosen complexity method, number of iterations to be performed, and a trade digit level). Various metrics are calculated, such as Economic- and Product complexity, distance, opportunity gain, and inequality metrics, to facilitate better decision making regarding industrial policy making. |
Authors: | Stellenbosch University Industrial Policy Research Group [aut, cph], Christiaan Pieterse [aut, cre, trl] , Wouter Bam [aut, ths] |
Maintainer: | Christiaan Pieterse <[email protected]> |
License: | GPL-3 |
Version: | 2.1.0 |
Built: | 2024-09-18 05:39:45 UTC |
Source: | https://github.com/cranhaven/cranhaven.r-universe.dev |
A dataset containing the trade data for country codes 4 and 710.
ExampleTradeData
ExampleTradeData
'ExampleTradeData' A data frame with 72097 rows and 6 variables:
Year
Product category, HS 6-digit code
Exporter, ISO 3-digit country code
Importer, ISO 3-digit country code
Value of the trade flow, in thousands current USD
Quantity, in metric tons
http://www.cepii.fr/CEPII/en/bdd_modele/bdd_modele_item.asp?id=37
Takes user inputted trade data, any acceptable ISO country code and industrial value chain mapping to calculate various metrics (Economic- and Product complexity metrics, distance metrics, opportunity gain, and inequality metrics) of a given country in order to facilitate better decision making regarding industrial policymaking.
IOPS( CountryCode, tradeData, ComplexMethod = "eigenvalues", iterCompl = 20, GVCMapping = NULL, tradedigit = 6 )
IOPS( CountryCode, tradeData, ComplexMethod = "eigenvalues", iterCompl = 20, GVCMapping = NULL, tradedigit = 6 )
CountryCode |
(Type: character/integer) Any accepted ISO country code could be used, e.g. |
tradeData |
(Type: csv) Accepts any CEPII BACI trade data. NOTE: tradeData and GVCMapping must be from the same "H" Family, e.g. both are from H3, etc., in order for the program to work correctly. |
ComplexMethod |
(Type: character) Methods used to calculate complexity measures. Can be any one of these methods: |
iterCompl |
(Type: integer) The number of iterations that the chosen complexity measure must use. Defaults to |
GVCMapping |
(Type: csv) The desired value chain to be analysed. With Columns "Tiers", "Activity", and "HSCode". NOTE: tradeData and GVCMapping must be from the same "H" Family, e.g. both are from H3, etc., in order for the program to work correctly. |
tradedigit |
(Type: integer) Indicate if the raw trade digit summation should be done on a 6- or 4-digit level. Defaults to tradedigit = 6. |
A list that constrains ECI, PCI, Opportunity_Gain, distance, density, M_absolute, M_binary, Tier_Results, Product_Category_Results, Product_Results, respectively.
# Create a temporary directory temp_dir <- tempfile() dir.create(temp_dir) # Set the working directory to the temporary directory old_dir <- setwd(temp_dir) #Generate example trade data GeneratedTradeData <- data.frame( t = c(2020, 2020, 2020), i = c(4, 710, 710), j = c(842, 124, 251), k = c(842410, 110220, 845210), v = c(4.776, 0.088, 0.057), q = c(0.025, 0.007, 0.005) ) # Use your function with generated trade data IOPS( CountryCode = 710, tradeData = GeneratedTradeData, ComplexMethod = "reflections", iterCompl = 2, GVCMapping = NULL, tradedigit = 6 ) # Use your function with real trade data IOPS( CountryCode = 710, tradeData = ExampleTradeData, ComplexMethod = "reflections", iterCompl = 2, GVCMapping = NULL, tradedigit = 6 ) # Clean up the temporary directory setwd(old_dir) # Restore the original working directory unlink(temp_dir, recursive = TRUE)
# Create a temporary directory temp_dir <- tempfile() dir.create(temp_dir) # Set the working directory to the temporary directory old_dir <- setwd(temp_dir) #Generate example trade data GeneratedTradeData <- data.frame( t = c(2020, 2020, 2020), i = c(4, 710, 710), j = c(842, 124, 251), k = c(842410, 110220, 845210), v = c(4.776, 0.088, 0.057), q = c(0.025, 0.007, 0.005) ) # Use your function with generated trade data IOPS( CountryCode = 710, tradeData = GeneratedTradeData, ComplexMethod = "reflections", iterCompl = 2, GVCMapping = NULL, tradedigit = 6 ) # Use your function with real trade data IOPS( CountryCode = 710, tradeData = ExampleTradeData, ComplexMethod = "reflections", iterCompl = 2, GVCMapping = NULL, tradedigit = 6 ) # Clean up the temporary directory setwd(old_dir) # Restore the original working directory unlink(temp_dir, recursive = TRUE)