Learn R Programming

bdl (version 1.0.5)

get_data_by_variable: Get data by variable Id from BDL API

Description

Retrieve data for a given variable for multiple units from BDL with specified format.

Usage

get_data_by_variable(
  varId,
  unitParentId = NULL,
  unitLevel = NULL,
  year = NULL,
  aggregateId = NULL,
  lang = c("pl", "en"),
  ...
)

Value

A dataset as a tibble.

Arguments

varId

A single variable Id or vector of multiple variable id's. If multiple id's are used, some columns are not available. Use search_variables or get_variables to find variable id code.

unitParentId

A 12 character NUTS id code of parent unit. Use search_units or get_units to find unit id code. If NULL (default) and unitLevel not set up, returns all available units for variable.

unitLevel

A number from 0 to 6, filters the returned unit by its level. If NULL (default) no level filters apply. Use get_levels to find more info.

year

A vector of years. If NULL (default) returns data for all available years.

aggregateId

An aggregate id. Use get_aggregates for more info.

lang

A language of returned data, "pl" (default), "en"

...

Other arguments passed on to GET. For example a proxy parameters, see details.

Details

Data to retrieve from The BDL Web Services can be filtered with arguments. To get JSON data from specified directory with custom filters use get_request directly.

To use a proxy to connect, a use_proxy can be passed to GET. For example get_request(id, filters, config = httr::use_proxy(url, port, username, password)).

Examples

Run this code
   # get_data_by_variable(varId = "3643", unitParentId = "030200000000")
   # get_data_by_variable("420", year = "2000", unitLevel = 6)
   
   # Multi variable download
   # get_data_by_variable(varId =c("415","420"), unitParentId = "030210423000")

Run the code above in your browser using DataLab