get_data: Get data for a particular table and variable selection

Description Usage Arguments Value Examples

View source: R/get_data.R

Description

Get data for a particular table and variable selection

Usage

1
get_data(table_id, variables, language = c("en", "da"))

Arguments

table_id

Table identifier, e.g. "folk1a"

variables

A list with variable code-values pairs. Each code-values pair should be a named list with names "code" and "values". If all values for a variable are desired, define values = NA for that variable code.

language

Language for the return object. Default = "en"

Value

A data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Get data from table "folk1c" for selected values of variables "ieland" and "køn"
# and all time periods available.

# The "ieland" variable is filtered for Denmark (id = 5000) and Bulgaria (id = 5128)
# and the "køn" variable id filtered for Men (id = 1) and Women (id = 2).
# The "tid" variable is unfiltered, i.e. selects all available time periods
# See get_table_metadata(table_id = "folk1c", variables_only = TRUE) for variable codes and values.

variables <- list(list(code = "ieland", values = c(5100, 5128)),
                  list(code = "køn", values = c(1,2)),
                  list(code = "tid", values = NA))

data <- get_data("folk1c", variables)

danstat documentation built on Jan. 31, 2022, 9:08 a.m.