R Interface for International Monetary Fund(IMF) Data API

Search, extract and formulate IMF's datasets.


Build Status

IMFData is an R package to access IMF (Internation Monetary of Fund) data . It has three main goals:

  • Findout available datasets in the API.
  • Findout the dataset datastructure and code to use to make a query.
  • Query through the API.

Installation

Right now, you can install

  • the latest development version from github with

    devtools::install_github('mingjerli/IMFData')

Loading the package

library(IMFData)

How to use IMFData

If you don't know anything about IMF data API, the following four steps is a good way to start.

availableDB <- DataflowMethod()
availableDB
availableDB$DatabaseID[1]

Findout how many dimension available in a given dataset. Here, we use IFS(International Financial Statistics) for example,

# 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 possible code to use in each dimension. Here, we want to search code related to GDP in CL_INDICATOR_IFS dimension,

# Search code contains GDP
CodeSearch(IFS.available.codes, 'CL_INDICATOR_IFS', 'GDP') 

Make API call to get data,

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]]

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("IMFData")

0.2.0 by Ming-Jer Lee, 4 years ago


https://github.com/mingjerli/IMFData


Browse source code at https://github.com/cran/IMFData


Authors: Ming-Jer Lee [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports httr, jsonlite, plyr


See at CRAN