Learn R Programming

popEpi (version 0.4.14)

all_names_present: 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)

Value

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

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

Author

Joonas Miettinen

See Also

[robust_values]