Gilrob
Gilrob

Reputation: 95

R OECD package not downloading dataset

I am facing a similar problem to what janelyuip was in this post: How to download data from OECD by using R package but the answers in that post are not working for me sadly!

I am using the OECD package, loaded from github rather than CRAN

I am able to run the example included in the CRAN documentation without any problem

df <- get_dataset("EPL_OV")

But when I do the same with any of the datasets that I actually want to download:

library (OECD)
library(tidyverse)

ANBERD_REV4 <- get_dataset("ANBERD_REV4")

BIBLIO <- get_dataset("BIBLIO")

I get the following error messages:

Error in download.file(path, destfile, method, quiet, mode, ...) : download from 'https://stats.oecd.org/restsdmx/sdmx.ashx/GetData/ANBERD_REV4/all/all' failed In addition: Warning message: In download.file(path, destfile, method, quiet, mode, ...) : URL 'https://stats.oecd.org/restsdmx/sdmx.ashx/GetData/ANBERD_REV4/all/all': Timeout of 60 seconds was reached

Error in download.file(path, destfile, method, quiet, mode, ...) : download from 'https://stats.oecd.org/restsdmx/sdmx.ashx/GetData/BIBLIO/all/all' failed In addition: Warning message: In download.file(path, destfile, method, quiet, mode, ...) : URL 'https://stats.oecd.org/restsdmx/sdmx.ashx/GetData/BIBLIO/all/all': Timeout of 60 seconds was reached

Would love some advice please!

Upvotes: 0

Views: 707

Answers (2)

Maria Polugodina
Maria Polugodina

Reputation: 21

R aborts the operation, if the download takes too long. It is good to use filters and not to download more data than you need, as suggested in the previous answer. If you really need to download a large dataset, which takes more than 60 seconds (default option in R), you can increase the limit. I copy the solution from here

To retrieve an option:

getOption('timeout')

To set an option:

options(timeout=100)

Upvotes: 2

lisa-marie
lisa-marie

Reputation: 54

In my case have solved the issue by limiting the data volume by filtering:

 ANBERD_REV4 <- get_dataset("ANBERD_REV4",
                             filter = "DEU+CHE.MA.NATCUR.DTOTAL",
                             start_time = 2012,
                             end_time = 2020,
                             pre_formatted = T)

For details on OECD data, search for your dataset at https://stats.oecd.org/, click on Export then SDMX (XML). There you will find all possible shortcuts for the filter of your dataset.

Upvotes: 2

Related Questions