View source: R/check_dataframe_variable.R
check_dataframe_variable | R Documentation |
Check if a data.frame contains variables
check_dataframe_variable( df, variable, name = "df", force_na = FALSE, error = TRUE )
df |
the |
variable |
either a character vector with the names of the variable to check or a named list. The names of the list must match the names of the required variables in the data.frame. The elements of the list contain the accepted classes for each varaible. |
name |
the name of the |
force_na |
check the class of variables with all NA |
error |
When TRUE (default), the function returns an error when a variable is missing. Otherwise it returns a warning. |
The function returns TRUE when all variables are present. If returns
FALSE when a variable is missing and error = FALSE
.
check_dataframe_variable( df = data.frame(a = integer(0)), variable = "a" ) check_dataframe_variable( df = data.frame(a = integer(0)), variable = list(a = c("integer", "numeric")) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.