get_data {danstat}R Documentation

Get data for a particular table and variable selection

Description

Get data for a particular table and variable selection

Usage

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

# 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)

[Package danstat version 0.1.0 Index]