Type: Package
Title: Search and Extract Data from the OECD
Version: 0.2.5
Date: 2021-12-01
Description: Search and extract data from the Organization for Economic Cooperation and Development (OECD).
License: CC0
URL: https://github.com/expersso/OECD
BugReports: https://github.com/expersso/OECD/issues
Imports: httr (≥ 0.6.1), readsdmx (≥ 0.3.0), methods (≥ 3.2.2), xml2 (≥ 0.1.2)
Suggests: rmarkdown, ggplot2, testthat, knitr
RoxygenNote: 7.1.1
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2021-12-01 19:33:48 UTC; persson
Author: Eric Persson [aut, cre]
Maintainer: Eric Persson <expersso5@gmail.com>
Repository: CRAN
Date/Publication: 2021-12-01 19:50:02 UTC

Browse the metadata related to a series.

Description

Opens up a web browser with the metadata related to the requested series.

Usage

browse_metadata(dataset, ...)

Arguments

dataset

A string specifying the code of the series.

...

Additional parameters passed to browseURL.

Value

Opens a web page in the default web browser.

Examples

## Not run: browse_metadata("DUR_D")


Get the data structure of a dataset.

Description

Returns a list of data frames containing names and descriptions of the variables of a specified series.

Usage

get_data_structure(dataset)

Arguments

dataset

A string containing the code for a dataset

Value

A list of data frames.

Examples

## Not run: get_data_structure("DUR_D")


Download OECD data sets.

Description

Returns a data frame with the requested data, downloaded through the OECD's API.

Usage

get_dataset(
  dataset,
  filter = NULL,
  start_time = NULL,
  end_time = NULL,
  pre_formatted = FALSE,
  ...
)

Arguments

dataset

A string with the code for the desired data set

filter

A list of character vectors specifying filters to be applied to each dimension of the dataset (see examples below). If no filter is specified, the function downloads all dimensions unfiltered.

start_time

Starting time for data. If left blank, no time filter is applied (i.e. all observations since the earliest available observation are downloaded). If end_time is specified, a start_time must also be specified.

end_time

End time for data.

pre_formatted

boolean. Set to TRUE if filter to be applied is already formatted (e.g. if copied from the OECD's SDMX generator (see example below)).

...

Additional parameters passed to data.frame (e.g. stringsAsFactors = FALSE).

Value

A data frame

Examples

# Get entire dataset 
## Not run: df <- get_dataset("EPL_OV")
## Not run: head(df, 10)

# Apply filter on dimensions "country" and "series"
## Not run: df <- get_dataset("EPL_OV", 
                           filter = list(c("DEU", "FRA"), 
                           c("EPRC_V1", "EPRC_V2")), 
                           start_time = 2008, end_time = 2010)
## End(Not run)
## Not run: head(df, 10)

# Use pre-formatted filter copied from stats.oecd.org
## Not run: df <- get_dataset("PATS_REGION", 
               filter = "PCT_A.INVENTORS.BEL+BE10+BE21.TOTAL+BIOTECH+ICT",
               start_time = 2008, end_time = 2010, pre_formatted = TRUE)
## End(Not run)
## Not run: head(df, 10)


Get a data frame with information on all available datasets.

Description

Returns a data frame with two variables: id and description

Usage

get_datasets(...)

Arguments

...

Additional parameters passed to httr::GET.

Value

A data frame.

See Also

search_dataset to search for a specific data set or a keyword in the description, and get_data_structure to get the dimensions of specified data set.

Examples

## Not run: datasets <- get_datasets()
## Not run: head(datasets)


Search codes and descriptions of available OECD series

Description

Returns a data frame containing the series codes and descriptions for the OECD series which match the given criteria.

Usage

search_dataset(string, data = get_datasets(), ignore.case = TRUE)

Arguments

string

A regular expression string to search for.

data

The data frame to search. This can be either a data frame previously fetched using get_datasets (recommended) or left blank, in which case a temporary data frame is fetched. The second option adds a few seconds to each search query.

ignore.case

Whether the search should be case-insensitive.

Value

A data frame.

See Also

get_datasets

Examples

## Not run: dsets <- get_datasets()
## Not run: search_dataset("employment", dsets)

mirror server hosted at Truenetwork, Russian Federation.