imf_data: Download a data from the IMF

Description Usage Arguments Value Examples

View source: R/data_functions.R

Description

Download a data from the IMF

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
imf_data(
  database_id,
  indicator,
  country = "all",
  start = 2000,
  end = current_year(),
  freq = "A",
  return_raw = FALSE,
  print_url = FALSE,
  times = 3
)

Arguments

database_id

character string database ID. Can be found using imf_ids.

indicator

character string or character vector of indicator IDs. These can be found using imf_codes.

country

character string or character vector of ISO two letter country codes identifying the countries for which you would like to download the data.See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. If country = 'all' then imf_data will attempt to download all available countries.

start

year for which you would like to start gathering the data.

end

year for which you would like to end gathering the data.

freq

character string indicating the series frequency. With 'A' for annual, 'Q' for quarterly, and 'M' for monthly.

return_raw

logical. Whether to return the data as an unprocessed list.

print_url

logical. Whether to print the URL used in the API call. Can be useful for debugging.

times

numeric. Maximum number of requests to attempt.

Value

If return_raw = FALSE then a data frame with just the requested data series are returned. If return_raw = TRUE then the raw data list is returned. This can include additional information about the series.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Download Real Effective Exchange Rate (CPI base) for the UK and China
# at an annual frequency
real_ex <- imf_data(database_id = 'IFS', indicator = 'EREER_IX',
               country = c('CN', 'GB'), freq = 'A')

## Not run: 
# Also download Interest Rates, Lending Rate, Percent per annum
ex_interest <- imf_data(database_id = 'IFS',
                         indicator = c('FILR_PA', 'EREER_IX'),
                         freq = 'M')

## End(Not run)

imfr documentation built on Oct. 23, 2020, 7:12 p.m.