set_variables {rolap}R Documentation

Set variables layer

Description

The variables layer includes the names and description through various fields of the variables contained in the reports.

Usage

set_variables(gl, variables, keep_all_variables_na)

## S3 method for class 'geolayer'
set_variables(gl, variables, keep_all_variables_na = FALSE)

Arguments

gl

A geolayer object.

variables

A tibble object.

keep_all_variables_na

A boolean, keep rows with all variables NA.

Details

When we set the variables layer, after filtering it, the data layer is also filtered keeping only the variables from the variables layer.

By default, rows that are NA for all variables are eliminated.

Value

A sf object.

See Also

Other query functions: as_GeoPackage(), as_geolayer(), filter_dimension(), get_layer(), get_variable_description(), get_variables(), run_query(), select_dimension(), select_fact(), set_layer(), star_query()

Examples


gl <- mrs_db_geo |>
  as_geolayer()

v <- gl |>
  get_variables()

v <- v |>
  dplyr::filter(year == '1966' | year == '2016')

gl_sel <- gl |>
  set_variables(v)


[Package rolap version 2.5.1 Index]