Send request from R to DBH-API and get data from DBH-API into R. Data are converted in right format using help function dbh_metadata dbh_metadata For token users it is possible to get token and use it further

dbh_data(
  table_id,
  filters = NULL,
  group_by = NULL,
  sort_by = NULL,
  exclude = NULL,
  variables = NULL,
  api_version = 1
)

Arguments

table_id

The code name for the dataset

filters

A named list, where the names are the names of the variables in the dataset to be filtered, and the values contain the matching conditions.

group_by

A list of variables to include in the aggregation for aggregating tables.

sort_by

A list of variables that define the sorting order.

exclude

A named list, where the names must also occur in filters, and the values specify values to be excluded from the filter.

variables

A list of variables to include in dataset

api_version

DBH-API version

Value

R dataframe

Examples

# Table with usage of filter and group by variables filter_example <- dbh_data (142, filters = list(Institusjonskode=c("top",3)), group_by = "Institusjonskode") # Table using bulk data bulk_example <- dbh_data(211)