Skip to contents

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 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.

Value

A sf object.

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.

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)