| Title: | An Interface to IMF (International Monetary Fund) Data JSON API |
|---|---|
| Description: | A straightforward interface for accessing the IMF (International Monetary Fund) data JSON API, available at <https://data.imf.org/>. This package offers direct access to the primary API endpoints: Dataflow, DataStructure, and CompactData. And, it provides an intuitive interface for exploring available dimensions and attributes, as well as querying individual time-series datasets. Additionally, the package implements a rate limit on API calls to reduce the chances of exceeding service limits (limited to 10 calls every 5 seconds) and encountering response errors. |
| Authors: | Pedro Baltazar [aut, cre] |
| Maintainer: | Pedro Baltazar <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.7.9000 |
| Built: | 2026-06-01 10:28:06 UTC |
| Source: | https://github.com/pedrobtz/imf.data |
List all available Time Series Datasets
list_datasets()list_datasets()
a data.frame with columns 'Id' and 'Description'.
d <- list_datasets() head(d)d <- list_datasets() head(d)
Loads Time Series Datasets
load_datasets(id, use_cache = TRUE)load_datasets(id, use_cache = TRUE)
id |
is character vector of Dataset Series identifier. |
use_cache |
is Boolean, defaults to TRUE, if TRUE it reloads the Dataset from cached values. |
a dataset object for the time-series identifier, i.e. a list containing a list 'dimensions' of data.frames with the valid dimensions values, and a function 'get_series' to retrieve time-series data.
DOT <- load_datasets("DOT") DOT$get_series(freq = "M", ref_area ="GB", indicator = "TMG_CIF_USD", counterpart_area = c("B0","W00"), start_period = "2022-01-01", end_period = "2022-12-31")DOT <- load_datasets("DOT") DOT$get_series(freq = "M", ref_area ="GB", indicator = "TMG_CIF_USD", counterpart_area = c("B0","W00"), start_period = "2022-01-01", end_period = "2022-12-31")
Calls API endpoint 'CompactData' to get Dataset time series
mt_compact_data(id, dimensions, start_period = NA, end_period = NA)mt_compact_data(id, dimensions, start_period = NA, end_period = NA)
id |
is a Dataset Series identifier. |
dimensions |
is a named list with the dimensions query. |
start_period |
is time series start date with formats. |
end_period |
is time series end date with format. See Details for the valid formats. |
The 'start_period' and 'end_pariod' parameters should have formats: 'yyyy', 'yyyy-mm' or 'yyyy-mm-dd'.
a list with content of 'CompactData' response.
DOT <- mt_compact_data("DOT", list("M","GB", "TMG_CIF_USD", c("B0","W00")))DOT <- mt_compact_data("DOT", list("M","GB", "TMG_CIF_USD", c("B0","W00")))
Calls API endpoint 'DataStructure'
mt_data_structure(id)mt_data_structure(id)
id |
is a Dataset Series identifier. |
a list with content of 'DataStructure' response.
DOT <- mt_data_structure("DOT")DOT <- mt_data_structure("DOT")
Calls API endpoint 'Dataflow'
mt_dataflow()mt_dataflow()
a list with content of 'Dataflow' response.
DF <- mt_dataflow()DF <- mt_dataflow()