checkVar {inTextSummaryTable} | R Documentation |
Check if variable(s) are present in reference: either in columns in a dataset or in reference set.
Description
Filter variables not present in the data or in reference set with a warning, and only returned filtered vector, or NULL if empty.
Usage
checkVar(
var,
varLabel,
varUncheck = NULL,
varRef,
refLabel = ifelse(!missing(varRef), "reference variable", "data"),
data,
msgType = c("warning", "error")
)
Arguments
var |
String with variable to check. |
varLabel |
String with label for |
varUncheck |
(Named) character vector with extra variables
in |
varRef |
(Named) character vector with set of reference variables. |
refLabel |
String with label for the reference |
data |
Data.frame with data. |
msgType |
String with type of message returned, either a 'warning' (default) or an error. |
Value
Depending on msgType
:
warning
: warning is printed in the console, and avar
filtered with element not indata
or inrefSet
is returned. If filteredvar
is empty, NULL is returned.error
: an error is triggered.
Author(s)
Laure Cougnaud
[Package inTextSummaryTable version 3.3.3 Index]