Check whether a data frame contains all the required variable
Source:R/supporting_functions.R
check_inputs.Rd
Checks whether a data frame contains all the required variables. Matching works via variable names, and used to support individual functions in the package. Not used directly.
Value
The default behaviour is to return an error message, informing the
user what variables are not included. When return
is set to "names", a
character vector containing the unmatched variable names is returned.
See also
Other Support:
any_idate()
,
camel_clean()
,
cut_hour()
,
extract_date_range()
,
extract_hr()
,
heat_colours()
,
is_date_format()
,
maxmin()
,
pairwise_count()
,
read_preamble()
,
rgb2hex()
,
totals_bind()
,
totals_col()
,
tstamp()
,
us_to_space()
,
wrap()
Examples
# Return error message
if (FALSE) { # \dontrun{
check_inputs(iris, c("Sepal.Length", "mpg"))
} # }
#' # Return warning message
check_inputs(iris, c("Sepal.Length", "mpg"), return = "warning")
#> Warning: The following variables are not included in the input data frame:
#> mpg
# Return variable names
check_inputs(iris, c("Sepal.Length", "Sepal.Width", "RandomVariable"), return = "names")
#> [1] "RandomVariable"