Thanks, Martin. I am trying this in Bengaluru, India, using R-studio. I
tried downloading a single variable. It happened fast, in less than 5
seconds. I tried downloading six variables, it took much longer, but less
than a minute. Tried eight variables and it did not download even in five
minutes. My internet speed is well above 40Mbps. This should not take that
long. It seems the process timed out. Please see below for some messages
from the system. I am using the latest version of WDI. I installed it
recently. I checked in the browser using the URL provided in the warning
messages: The World Bank web API gave me the indicator in less than a
second.
> system.time(dat3IN <- WDI(indicator =
c('NY.ADJ.NNAT.GN.ZS','NY.GNS.ICTR.GN.ZS','NY.ADJ.DCO2.GN.ZS','NY.ADJ.DNGY.GN.ZS',
'NY.ADJ.DFOR.GN.ZS', 'NY.ADJ.DPEM.GN.ZS',
'NY.ADJ.DMIN.GN.ZS', 'NY.ADJ.DRES.GN.ZS'), country =
c('IN'), start=1960)) user system elapsed
0.14 0.01 328.65 Warning messages:
1: In open.connection(con, "rb") :
URL
'https://api.worldbank.org/v2/en/country/IN/indicator/NY.ADJ.NNAT.GN.ZS?format=json&date=1960:2029&per_page=32500&page=10':
Timeout of 60 seconds was reached
2: In open.connection(con, "rb") :
URL
'https://api.worldbank.org/v2/en/country/IN/indicator/NY.GNS.ICTR.GN.ZS?format=json&date=1960:2029&per_page=32500&page=1':
Timeout of 60 seconds was reached
3: In open.connection(con, "rb") :
URL
'https://api.worldbank.org/v2/en/country/IN/indicator/NY.GNS.ICTR.GN.ZS?format=json&date=1960:2029&per_page=32500&page=4':
Timeout of 60 seconds was reached
4: In WDI(indicator = c("NY.ADJ.NNAT.GN.ZS",
"NY.GNS.ICTR.GN.ZS",
"NY.ADJ.DCO2.GN.ZS", :
The following indicators could not be downloaded: NY.GNS.ICTR.GN.ZS.
Please make sure that you are running the latest version of the `WDI`
package, and that the arguments you are using in the `WDI()` function
are valid.
Sometimes, downloads will suddenly stop working, even if nothing has
changed in the R code of the WDI package. ("The same WDI package
version worked yesterday!") In those cases, the problem is almost
certainly related to the World Bank servers or to your internet
connection.
You can check if the World Bank web API is currently serving the
indicator(s) of interest by typing a URL of this form in your web
browser:
https://api.worldbank.org/v2/en/country/all/indicator/NY.GNS.ICTR.GN.ZS?format=json&date=:&per_page=32500&page=1
On Fri, 9 Aug 2024 at 18:38, Martin Maechler <maechler at
stat.math.ethz.ch>
wrote:
> >>>>> Ivan Krylov via R-help
> >>>>> on Fri, 9 Aug 2024 15:23:58 +0300 writes:
>
> > ? Thu, 8 Aug 2024 12:43:23 +0530
> > Anupam Tyagi <anuptyagi at gmail.com> ?????:
>
> >> In open.connection(con, "rb") :
> >> URL
> >> '
>
https://api.worldbank.org/v2/en/country/OED/indicator/NY.ADJ.NNAT.GN.ZS?format=json&date=1977:2020&per_page=32500&page=1
> ':
> >> Timeout of 60 seconds was reached
>
> > If you try to open the link in the browser, does it work? How long
> does
> > it take to download? Try increasing options(timeout=...) to a
larger
> > time (in seconds).
>
> > I see there is Cloudflare sitting in front of the API, but
it's
> > relatively non-aggressive. I could only get it to deny my request
by
> > accessing it through Tor.
> ;-\
>
> In R (but *not* inside RStudio), I see {from Zurich, Switzerland},
>
> > require(WDI)
> Loading required package: WDI
> > system.time(dat1EU <-
> WDI(indicator = c('NY.ADJ.NNAT.GN.ZS',
'NY.GNS.ICTR.GN.ZS'), country
> = c('EU'), start=1977, end=2020))
>
> user system elapsed
> 0.466 0.028 5.828
> >
> > str(dat1EU)
> 'data.frame': 44 obs. of 6 variables:
> $ country : chr "European Union" "European
Union" "European
> Union" "European Union" ...
> $ iso2c : chr "EU" "EU" "EU"
"EU" ...
> $ iso3c : chr "EUU" "EUU"
"EUU" "EUU" ...
> $ year : int 1977 1978 1979 1980 1981 1982 1983 1984 1985
> 1986 ...
> $ NY.ADJ.NNAT.GN.ZS: num 9.13 9.57 9.36 7.83 5.67 ...
> ..- attr(*, "label")= chr "Adjusted savings: net
national savings (%
> of GNI)"
> $ NY.GNS.ICTR.GN.ZS: num 23 23.4 23.2 22.3 20.8 ...
> ..- attr(*, "label")= chr "Gross savings (% of
GNI)"
> >
>
> which seems pretty nice, similar to Ivan's experience
>
> > --
> > Best regards,
> > Ivan
>
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more,
see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
--
Anupam.
[[alternative HTML version deleted]]