Skip to contents

Function to extract the possible values from a variable. Values for continuous variables are not extractable, which is why the function returns a warning message in this case.

Usage

gen_val2var(
  code = NULL,
  database = c("all", "genesis", "zensus", "regio"),
  area = c("all", "public", "user"),
  sortcriterion = c("code", "content"),
  error.ignore = TRUE,
  verbose = TRUE,
  ...
)

Arguments

code

Character string with a maximum length of 15 characters. Code from a GENESIS, Zensus 2022 or regionalstatistik.de object. Only one code per iteration.

database

Character string. Indicator if the GENESIS ('genesis'), Zensus 2022 ('zensus') or regionalstatistik.de ('regio') database is called. Default option is 'all'.

area

Character string. Indicator from which area of the database the results are called. In general, 'all' is the appropriate solution. Default option is 'all'. Not used for 'statistics'.

sortcriterion

Character string. Indicator if the output should be sorted by 'code' or 'content'. This is a parameter of the API call itself. The default is 'code'.

error.ignore

Boolean. Indicator for values if the function should stop if an error occurs or no object for the request is found or if it should produce a token as response. Default option is 'TRUE', this prevents the function to stop even if a variable has no further explanation (often the case for numerical variables).

verbose

Boolean. Indicator if the output of the function should include detailed messages and warnings. Default option is 'TRUE'. Set the parameter to 'FALSE' to suppress additional messages and warnings.

...

Additional parameters for the API call. These parameters are only affecting the call itself, no further processing. For more details see vignette("additional_parameter").

Value

A list with all recalled elements from the API. Always includes the code of the object, the title, and the type of the object. This is done to facilitate further processing with the data. Attributes are added to the data.frame describing the search configuration for the returned output.

Examples

if (FALSE) { # \dontrun{
# Find the values of the variable "DLAND"
object <- gen_val2var(code = "DLAND")
} # }