Query data from OECD.Stat using SDMX

sdmxRead(api = "http://stats.oecd.org/SDMX-JSON", scheme = "data",
  DSD = "BTDIXE_I4", filter = list(COU = c("ESP", "DEU"), FLW = c("IMPO"),
  PAR = c("WOR"), EUC = c("TOTAL", "INT"), IND = c("DTOTAL", "D01T03"), VAL =
  c("VALUE")), append = paste0("/all?", paste("json-lang=en", "detail=Full",
  "dimensionAtObservation=AllDimensions", "startPeriod=2000", "endPeriod=2010",
  sep = "&")), query = FALSE)

Arguments

api

an API address

scheme

an API scheme. Available schemes data, codelist.

DSD

a datastructure definition identified by the triplet [collection; country; indicator].

filter

for scheme "data": a named list of filters passed to the API. The position of list items corresponds to the API filter dimensions. Each list item is either empty (no filter on dimension) or a character vector containing dimension members to be included in the results. Dimension members can be obtained from scheme="codelist" and a codelist item, e.g. "CL_ECO_ISIC4".

append

append string to the dimension url.

query

logical to return SDMX http url only.

Details

Helper function to efficiently query data from OECD.Stat Extracts using SDMX-JSON API.

See also

https://data.oecd.org/api/sdmx-json-documentation

Examples

# NOT RUN {
## list dimension members
test.codelist <- sdmxRead(DSD = "BTDIXE_I4", scheme = "codelist")
## retrieve data
filter.list <- list(COU = c("ESP", "DEU"),
                    FLW = c("IMPO"),
                    PAR = c("WOR"),
                    EUC = c("TOTAL", "INT"),
                    IND = c("DTOTAL", "D01T03"),
                    VAL = c("VALUE"))
url.append <- paste0("/all?",
                     paste("json-lang=en", "detail=Full",
                           "dimensionAtObservation=AllDimensions",
                           "startPeriod=1990", "endPeriod=2000",
                           sep = "&"))
test.data <- sdmxRead(DSD = "BTDIXE_I4", filter = filter.list)
# }