Internal function to validate the argument df
and ensure it complies with the requirements of the package functions. It performs the following actions:
Stops if 'df' is NULL.
Stops if 'df' cannot be coerced to data frame.
Stops if 'df' has zero rows.
Removes geometry column if the input data frame is an "sf" object.
Removes non-numeric columns with as many unique values as rows df has.
Converts logical columns to numeric.
Converts factor and ordered columns to character.
Tags the data frame with the attribute
validated = TRUE
to let the package functions skip the data validation.
See also
Other data_validation:
validate_data_cor()
,
validate_data_vif()
,
validate_encoding_arguments()
,
validate_predictors()
,
validate_preference_order()
,
validate_response()
Examples
data(vi)
#validating example data frame
vi <- validate_df(
df = vi
)
#tagged as validated
attributes(vi)$validated
#> [1] TRUE