[R] WDI package commands timing out and not working

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Fri Aug 9 15:08:39 CEST 2024


>>>>> 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 using 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 using 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.



More information about the R-help mailing list