Mask with WDI to get data from several countries

hello all

I am successfully downloading inflation from WDI with rdb("WB","WDI","A-FP.CPI.TOTL.ZG-USA") but am unable to figure out how to use a mask to get inflation for all (or several) countries. rdb("WB","WDI","A-FP.CPI.TOTL.ZG-.") or rdb("WB","WDI","A-FP.CPI.TOTL.ZG-USA+DEU") will not work. And I tried every combination I could think of. I must be missing something incredibly stupid, but if anybody knows, much appreciated.

best, jack

Hey Jack,

just a fellow user, so I cannot be sure that this works but at least on the Matlab fetcher documentation the World Bank is not part of the providers that accept masks, here is the list:

  • BIS
  • ECB
  • Eurostat
  • FED
  • IMF
  • IMF-WEO
  • INSEE
  • OECD
  • WTO

Otherwise, no idea if this works but have you tried

rdb("WB","WDI","A-FP.CPI.TOTL.ZG-USA+ZG-DEU")
or
rdb("WB","WDI","A-FP.CPI.TOTL..")
It seems ZG is part of the country name, is it not?

Hi all,

Sorry for the delay, and thanks for your question.

After looking at https://db.nomics.world/WB/WDI/A-FP.CPI.TOTL.ZG-USA, I noticed that some dimension codes of WB/WDI include dots (.), which prevents from using masks!

Here ZG is not part of the country code, but of the “Inflation, c…”.

Moreover, as dots are part of some dimension codes, the author of wb-fetcher chose to separate dimensions using a dash (-) instead of a dot.

In short: it is not possible to use masks with WB/WDI.

However, you may use another form of calling rdb consisting in passing the dimensions as JSON. As I’m not a R user, I didn’t try it, but inferred the following line from the PDF manual of rdbnomics:

df <- rdb("WB", "WDI", dimensions = '{"frequency":["A"],"indicator":["FP.CPI.TOTL.ZG"]}')

As the “country” dimension is not set, all the countries should be returned.

Here is a link to the web API of DBnomics doing the same thing (I’ve set observations=0 to avoid flooding your connection, but feel free to enable them if needed):

https://api.db.nomics.world/v22/series/WB/WDI?observations=0&dimensions={"frequency":["A"],"indicator":["FP.CPI.TOTL.ZG"]}