powered by
Internal function to validate and prepare the input data frame for a multicollinearity analysis.
Validates a data frame to ensure it complies with the requirements of the package functions. The function 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.
Raise warning if number of rows of 'df' is lower than 'min_rows'.
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.
validated = TRUE
validate_df(df = NULL, min_rows = 30)
The input data frame modified to comply with the requirements of the functions in this package
(required; data frame or matrix) Input data frame. Default: NULL
(required; integer) Minimum number of rows required for a pairwise correlation or a variance inflation factor analysis. Default: 30
Blas M. Benito
data(vi) #validating example data frame vi <- validate_df( df = vi ) #tagged as validated attributes(vi)$validated
Run the code above in your browser using DataLab