Skip to contents

Asserts the specified vars are present in the supplied referendum data. Depending on vars, additional integrity checks are performed.

Usage

assert_vars(data, vars)

Arguments

data

RDB referendum data as returned by rfrnds().

vars

Names of the variables to check. A character vector.

Value

data, invisibly.

Examples

rdb::rfrnd(id = "5bbbe26a92a21351232dd73f") |> rdb::assert_vars(vars = "country_code")

try(
  tibble::tibble(country_code = "AN") |> rdb::assert_vars(vars = "country_code")
)
#> Error in map(.x, .f, ..., .progress = .progress) : 
#>    In index: 1.
#> Caused by error in `assert_content()` at rdb/R/rdb.gen.R:3523:5:
#> ! Assertion on `data$country_code` failed: The following country codes have been deleted from ISO 3166-1 and were moved to ISO 3166-3 (former countries)
#>   instead: "AN"