## Warning: The `path` argument of `write_lines()` is deprecated as of readr 1.4.0.
## ℹ Please use the `file` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
The rwebstat package was created to facilitate access to the webstat API. All the data are available on Webstat, the official external data provider website of Banque de France.
The first version was published on CRAN 2019-05-24.
The first step is to register on the API at link.
You can find operating procedure at these links ( fr and en )
Once done, you have to login and create an App which will give you an API key (personal Client ID).
There are multiple ways to enter your API key. The simpler one is to store it in a global variable named “webstat_client_api” :
If you forget to create the variable, don’t worry, the first function call will prompt you to enter it into RStudio Console.
To use efficiently rwebstat inside
the Bank domain, you have to set your proxy with the
proxy_bdf()
function. Just enter your password when
prompted.
In any case, you need to set your proxy parameters (if you have any) in order to request the Webstat API.
This section will give you an overview of what you can do with rwebstat.
Data are stored in Series (time series). Series are stored in Datasets.
Series id are Series keys (sdmx format). Datasets id are strings.
We can easily recover Datasets and Series catalogues :
Webstat offers
more than 40 Datasets. The w_datasets()
function returns
the datasets catalogue :
Webstat corrently
offers more than 40.000 Series. The w_series_list()
function returns the series catalogue.
For example, we ask the EXR dataset catalogue (only top rows are displayed here) :
Download all Series of a specific Dataset or an individual Serie with
w_data()
function :
Download a specific Serie (series_name
and
dataset_name
arguments are flexible) :
We don’t always know the exact Serie(s) key(s) we want to request.
The w_search()
function search keyword
(regexp
are accepted) inside catalogues.
For example, we look for the keyword
“monetary” into the
Dataset catalogue :
The keyword
argument can be written in a regexp form to
be more efficient.
The w_meta()
function return metadatas of a Serie. The
language of the metadata will be the same as the language chosen for the
Serie :
The w_structure()
function returns information on the
structure of a specific Dataset as a R list :
Elements of the structure list :
A Serie key (SDMX format) is a chain of strings separated with dots (M.USD.EUR.SP00.E). Each string is a dimension,
Dimensions of a Serie key from the EXR Dataset :
We want to get back the last values of all Exchange rates Series (EXR Dataset) involving a “dollar” currency.
First we search the EXR Dataset for all the Series containing the “dollar” keyword :
We have a list of 24 Series :
We then apply the w_data()
function to the SeriesKey
vector we found in the search :
Feel free to contact us with any question about the API or this package using this e-mail address.