Skip to contents

Based on fgeo.tool::check_crucial_names()

Usage

check_crucial_names(x, expected_names)

Arguments

x

A named object.

expected_names

String; expected names of x.

Value

Invisible x, or an error with informative message.

Adapted from: https://github.com/RMI-PACTA/r2dii.match/blob/main/R/check_crucial_names.R

Examples

x <- c(a = 1)
check_crucial_names(x, "a")
try(check_crucial_names(x, "bad"))
#> Error in abort_missing_names(sort(setdiff(expected_names, names(x)))) : 
#>   Must have missing names:
#> `bad`