UNCOMTRADE from R
# uncomtrade.R : UN comtrade
require(comtradr)
require(dplyr)
require(foreign)
setwd('C:/_codeGDI')
aseanex <- ct_search(reporters = c("China", "Japan",
"Rep. of Korea"),
partners = c("Indonesia", "Malaysia", "Singapore", "Philippines", "Thailand"),
trade_direction = "imports", type = "goods",
start_date = 2000, end_date = 2004)
asean2000 <- aseanex[c("year", "reporter_iso", "partner_iso",
"trade_value_usd")]
aseanex2 <- ct_search(reporters = c("China", "Japan",
"Rep. of Korea"),
partners = c("Indonesia", "Malaysia", "Singapore", "Philippines", "Thailand"),
trade_direction = "imports", type = "goods",
start_date = 2005, end_date = 2009)
asean2005 <- aseanex2[c("year", "reporter_iso", "partner_iso", "trade_value_usd")]
aseanex3 <- ct_search(reporters = c("China", "Japan", "Rep. of Korea"),
partners = c("Indonesia", "Malaysia", "Singapore", "Philippines", "Thailand"),
trade_direction = "imports", type = "goods",
start_date = 2010, end_date = 2014)
asean2010 <- aseanex3[c("year", "reporter_iso", "partner_iso", "trade_value_usd")]
asean <- dplyr::bind_rows(asean2000, asean2005, asean2010)
summary(asean)
rm(asean2000, asean2005, asean2010, aseanex, aseanex2, aseanex3)
write.dta(asean, 'C:/_codeGDI/aseantrade20002010.dta')
require(comtradr)
require(dplyr)
require(foreign)
setwd('C:/_codeGDI')
aseanex <- ct_search(reporters = c("China", "Japan",
"Rep. of Korea"),
partners = c("Indonesia", "Malaysia", "Singapore", "Philippines", "Thailand"),
trade_direction = "imports", type = "goods",
start_date = 2000, end_date = 2004)
asean2000 <- aseanex[c("year", "reporter_iso", "partner_iso",
"trade_value_usd")]
aseanex2 <- ct_search(reporters = c("China", "Japan",
"Rep. of Korea"),
partners = c("Indonesia", "Malaysia", "Singapore", "Philippines", "Thailand"),
trade_direction = "imports", type = "goods",
start_date = 2005, end_date = 2009)
asean2005 <- aseanex2[c("year", "reporter_iso", "partner_iso", "trade_value_usd")]
aseanex3 <- ct_search(reporters = c("China", "Japan", "Rep. of Korea"),
partners = c("Indonesia", "Malaysia", "Singapore", "Philippines", "Thailand"),
trade_direction = "imports", type = "goods",
start_date = 2010, end_date = 2014)
asean2010 <- aseanex3[c("year", "reporter_iso", "partner_iso", "trade_value_usd")]
asean <- dplyr::bind_rows(asean2000, asean2005, asean2010)
summary(asean)
rm(asean2000, asean2005, asean2010, aseanex, aseanex2, aseanex3)
write.dta(asean, 'C:/_codeGDI/aseantrade20002010.dta')
0 Comments:
Post a Comment
<< Home