all_names_present: Check if all names are present in given data

View source: R/utility_functions.R

all_names_presentR Documentation

Check if all names are present in given data

Description

Given a character vector, checks if all names are present in names(data). Throws error if stops=TRUE, else returns FALSE if some variable name is not present.

Usage

all_names_present(data, var.names, stops = TRUE, msg = NULL)

Arguments

data

dataset where the variable names should be found

var.names

a character vector of variable names, e.g. c("var1", "var2")

stops

logical, stop returns exception

msg

Custom message to return instead of default message. Special: include %%VARS%% in message string and the missing variable names will be inserted there (quoted, separated by comma, e.g. 'var1', 'var2' — no leading or tracing white space).

Value

'TRUE' if all 'var.names' are in 'data', else 'FALSE',

Author(s)

Joonas Miettinen

See Also

robust_values


WetRobot/popEpi documentation built on Aug. 29, 2023, 3:53 a.m.