Learn R Programming

inTextSummaryTable (version 3.3.2)

checkVar: 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")
)

Value

Depending on msgType:

  • warning: warning is printed in the console, and a var filtered with element not in data or in refSet is returned. If filtered var is empty, NULL is returned.

  • error: an error is triggered.

Arguments

var

String with variable to check.

varLabel

String with label for var, e.g. name of associated parameter.

varUncheck

(Named) character vector with extra variables in var which shouldn't be checked.

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.

Author

Laure Cougnaud