A typical workflow begins with using the Leontief decomposition in
the decompr package.
# load the decompr package
library(decompr)## Please consider citing R and decompr,
## using citation()
## citation('decompr')We will use the example data set.
# load the example data set
data(leather)
attach(leather)and apply the leontief decomposition and post multiply with exports
l <- decomp(x = inter,
            y = final,
            k = countries,
            i = industries,
            o = out,
            method = "leontief",
            post = "exports"    )We can now analyse the l object with the
gvc package.
library(gvc)## Please consider citing R and gvc,
## citation()
## citation('gvc')For instance, using the New Revealed Comparative
Advantage (nrca()),
nrca(l)## [1] 1.2676927 1.0581114 0.1533582 1.0087530 1.3176076 0.3068102 0.8635848
## [8] 0.7080925 1.9843574or using Importing to Export
(i2e()),
i2e(l)##     country              sector       i2e
## 1 Argentina         Agriculture  3.404712
## 2 Argentina Textile_and_Leather  6.443233
## 3 Argentina Transport_Equipment  0.762098
## 4    Turkey         Agriculture  7.467932
## 5    Turkey Textile_and_Leather 11.125843
## 6    Turkey Transport_Equipment  2.544472
## 7   Germany         Agriculture  5.632133
## 8   Germany Textile_and_Leather  5.280111
## 9   Germany Transport_Equipment 25.397173