Git Product home page Git Product logo

r-io-ps's Introduction

R-IO-PS

A public repository of developmental R code related to the input-output product space (IO-PS) to facilitate better decision-making regarding industrial policymaking.

Package

Installation

The package is available to install from CRAN

install.packages(iopspackage)
library(iopspackage)

The package is also available to install via GitHub: https://github.com/WoutersResearchGroup/R-IO-PS

devtools::install_github("WoutersResearchGroup/R-IO-PS")
library(iopspackage)

Libraries Required

To successfully run the package, numerous other packages need to be installed and loaded into the library:

library(openxlsx)
library(dplyr)
library(tidyr)
library(economiccomplexity)

Usage

CEPII-BACI trade data is a required input (.csv). The BACI data is available at: http://www.cepii.fr/CEPII/fr/bdd_modele/presentation.asp?id=37

Full IO-PS analysis requires a value chain input (.csv). Three columns are required: 'Tier', 'Activity' and 'HSCode'.

#-----Load Trade data and value chain into variables-----#
TradeDataused <- read.csv("BACI_HSXX_YXXXX_V202001.csv")
VCDataUsed <- read.csv("X_Value_Chain.csv")

#-----Run IOPS with Input Trade Data and Value Chain Mapping-----#
IOPS(
  tradeData = TradeDataused,
  GVCMapping = VCDataUsed
)

Value Chain Output

Results are generated at tier, category and product level. Results are written to an Excel spreadsheet and headless CSV file named 'Combined_Results'. Each `Combined_Results' file contains the Tier Results, Product Results and Product Category Results.

Combined_Results.xlsx
Combined_Results.csv

Function

IOPS(CountryCode = 710, tradeData, ComplexMethod = "eigenvalues", iterCompl = 20, GVCMapping = NULL, tradedigit = 6)
    """ IO-PS calculation function that writes the results to .xls and .csv
        Arguments:
            CountryCode - Type: character/integer. Any accepted ISO country code could be used, e.g. "United Kingdom", "GBR"}, "GB", "828" would all be accepted if the United Kingdom is the desired country.
            tradeData - Type: csv. Accepts any CEPII BACI trade data.
            ComplexMethod - Type: character. Methods used to calculate complexity measures. Can be any one of these methods: "fitness", "reflections" or "eigenvalues". Defaults to "eigenvalues".
            iterCompl - Type: integer. The number of iterations that the chosen complexity measure must use. Defaults to iterCompl = 20.
            GVCMapping - Type: csv. The desired value chain to be analysed. With Columns "Tiers", "Activity", and "HSCode".
            tradedigit - Type: Integer.  Indicate if the raw trade digit summation should be done on a 6- or 4-digit level. Defaults to tradedigit = 6.
    """

Future Considerations

  • Address the remaining deviations from the py_IO-PS package, especially maximum deviations.
  • Triangulate the R-package across different packages (Python and MATLAB).
  • Incorporate a CEPII API in the R code for easier, automated data access.
  • Consider adding functionality to access an index of all countries and corresponding codes, simplifying the analysis process.
  • Enhance the package's functionality by adding a time period parameter which allows the user to choose specific years for cross-period measures and evaluations.

References

Economic Complexity and Product Complexity

This package uses the economiccomplexity package available from CRAN to calculate economic complexity indices. Available at: https://pacha.dev/economiccomplexity/

r-io-ps's People

Contributors

christiaanpieterse avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.