Reputation: 51
I try to use the function "get_data_structure" but got an error as below. Could anyone know how to fix it?
Thank you in advance
get_data_structure("DUR_D") Error in data.frame(data_structure@concepts) : trying to get slot "concepts" from an object (class "data.frame") that is not an S4 object
Upvotes: 4
Views: 879
Reputation: 325
It is a bug in the package OECD 0.2.5.
It works with the package version 0.2.4 which you can install from CRAN's archived package section (https://cran.r-project.org/src/contrib/Archive/OECD).
If you want to access the archived package version directly in R, use the following code:
devtools::install_version("OECD", version = "0.2.4", repos = "https://stat.ethz.ch/CRAN/")
Note that this requires the package 'devtools' to be installed.
Upvotes: 2
Reputation: 2282
remotes::install_github("https://github.com/expersso/OECD")
library(OECD)
dataset <- "DUR_D"
dstruc <- get_data_structure(dataset)
Try with get_dataset("DUR_D")
i.e. without -s. as get_datasets()
with -s
will return a dataframe of available datasets.
Upvotes: 1
Reputation: 44927
The problem appears to be a bug in the version of the OECD
package on CRAN. If you install the development version, it works. First, close R and reopen a clean new session, then run this:
remotes::install_github("https://github.com/expersso/OECD")
library(OECD)
get_datasets()
get_data_structure("DUR_D")
Upvotes: 3