knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
IMFData is an R package to access IMF (Internation Monetary Fund) data . It has three main goals:
Right now, you can install
install.packages('IMFData')
devtools::install_github('mingjerli/IMFData')
library(IMFData)
If you don't know anything about IMF data API, the following four steps is a good way to start.
availableDB <- DataflowMethod() availableDB$DatabaseID availableDB$DatabaseText
# Get dimension code of IFS dataset IFS.available.codes <- DataStructureMethod('IFS') # Available dimension code names(IFS.available.codes) # Possible code in the first dimension IFS.available.codes[[1]]
# Search code contains GDP CodeSearch(IFS.available.codes, 'CL_INDICATOR_IFS', 'GDP')
databaseID <- 'IFS' startdate='2001-01-01' enddate='2016-12-31' checkquery = FALSE ## Germany, Norminal GDP in Euros, Norminal GDP in National Currency queryfilter <- list(CL_FREA="", CL_AREA_IFS="GR", CL_INDICATOR_IFS =c("NGDP_EUR","NGDP_XDC")) GR.NGDP.query <- CompactDataMethod(databaseID, queryfilter, startdate, enddate, checkquery) GR.NGDP.query[,1:5] GR.NGDP.query$Obs[[1]] GR.NGDP.query$Obs[[2]] ## Quarterly, US, NGDP_SA_AR_XDC queryfilter <- list(CL_FREA="Q", CL_AREA_IFS="US", CL_INDICATOR_IFS ="NGDP_SA_AR_XDC") Q.US.NGDP.query <- CompactDataMethod(databaseID, queryfilter, startdate, enddate, checkquery) Q.US.NGDP.query[,1:5] Q.US.NGDP.query$Obs[[1]] ## See exact API call to the data source CompactDataMethod(databaseID, queryfilter, startdate, enddate, checkquery, verbose=TRUE)$Obs[[1]] ## Return a simple data frame head(CompactDataMethod(databaseID, queryfilter, startdate, enddate, checkquery, tidy=TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.