variable_country_specific_categories: Retrieve the categories of a country-specific variable in...

View source: R/get_country_specifc_categories.R

variable_country_specific_categoriesR Documentation

Retrieve the categories of a country-specific variable in LIS/LWS for a given country.

Description

Retrieve the categories of a country-specific variable in LIS/LWS for a given country.

Usage

variable_country_specific_categories(
  variable,
  iso2,
  from = NULL,
  to = NULL,
  lws = FALSE,
  n_categories = FALSE
)

Arguments

variable

A unit-length character vector containing a LIS/LWS country-specific (with the "_c" suffix) variable.

iso2

A character vector with a valid iso2 code for countries present in LIS/LWS.

from

A numeric value representing the year (inclusive) after which the LIS/LWS datasets should be considered.

to

A numeric value representing the year (inclusive) up to which the LIS/LWS datasets should be considered.

lws

A logical value, that guides the tool to search in the LIS or LWS database. The argument is FALSE by default, taking LIS as the databse to be investigated if nothing is specified.

n_categories

A logical value indicating whether to output the number of categories of a single country-specific variable, across the entire time series for a given country.

Value

A list made of character vectors. If n_categories = TRUE, then a list with a numeric vector.

Examples

# In years where no data is recorded for a given variable, it is automatically hidden from the output
variable_exists(variable = "health_c", iso2 = "it")
variable_country_specific_categories(variable = "health_c", iso2 = "it", from = 1995, to = 2020) 

# To retrieve information on LWS datasets
variable_country_specific_categories(variable = "bus1_c", iso2 = "fi", lws = TRUE)

# Using the `n_categories` argument
variable_country_specific_categories(variable = "region_c", iso2 = "es", n_categories = TRUE)

# To use this function acroos multiples countries one could make use of the `purrr::map()` function 
purrr::map(lissyrtools::get_countries_lws(), ~variable_country_specific_categories(variable = "bus1_c", iso2 = .x, lws = TRUE , n_categories = TRUE))


JosepER/lissyrtools documentation built on June 12, 2025, 12:11 p.m.