Compares names(value) with a reference. One verb covers "exactly these
names in this order", "only allowed names" and "at least these names".
Usage
require_names(
restriction,
names,
mode = c("identical", "subset", "superset", "permutation")
)Arguments
- restriction
a
restrictionobject.- names
character vector of reference names.
- mode
how the observed names relate to
names:"identical": the same names in the same order;"subset": every observed name is innames(no unexpected names);"superset": every name innamesis present (nothing missing);"permutation": the same names in any order, each occurring as often.
Details
A value without names has no names: it fails every mode except
"subset". The failure lists the missing and the unexpected names.
See also
Other structure checks:
require_dim(),
require_has_cols(),
require_length(),
require_length_matches(),
require_length_max(),
require_length_min(),
require_named(),
require_ncol_matches(),
require_ncol_min(),
require_nrow_matches(),
require_nrow_min(),
require_scalar(),
require_sorted(),
require_unique_names()