The banxicoR package is now available on CRAN. Much like inegiR this package aims to bring official Mexican data easily into R, in this case by scrapping iqy calls to the SIE (Sistema de Información Económica) webservice of the Bank of Mexico.
The major difference with inegiR is that the Bank of Mexico does not have an API, so this package basically uses rvest to scrape the generated html. The package then does what it can to save it in a convenient data.frame or list (same as inegiR).
A few caveats:
I do not control the data definitions at the source (Banxico), so I can’t guarantee continuos use.
Finding the ID of each series has proven a manual, slow and tedious process because they are not available in the webpage. I’m trying to contact Banxico about getting a catalog, but basically use at your own risk.
Finding series ID’s
To find a specific series ID, I would recommend going to the SIE webpage, navigating towards the desired indicators and then consulting them via HTML. The column name should be the series id (they are usually in this format: “SF60653”, with two characters followed by numbers). The package includes a small and non exhaustive catalog of series in spanish. You can access this by data("BanxicoCatalog").
Then you can find some id’s…
Now that you have some id’s to download, we can use the banxico_series function…
If you want some other fancy things, you can use the options…
Finally, we can graph this…
This data series is also available at INEGI and can be downloaded with inegiR but Banxico has other interesting series exclusive to them, like financial loans or money in circulation, which I encourage everyone to check out!