validate_predictors_are_numeric: Ensure predictors are all numeric

Description Usage Arguments Details Value Validation See Also Examples

View source: R/validation.R

Description

validate - asserts the following:

check - returns the following:

Usage

1
2
3

Arguments

predictors

An object to check.

Details

The expected way to use this validation function is to supply it the $predictors element of the result of a call to mold().

Value

validate_predictors_are_numeric() returns predictors invisibly.

check_predictors_are_numeric() returns a named list of two components, ok, and bad_classes.

Validation

hardhat provides validation functions at two levels.

See Also

Other validation functions: validate_column_names(), validate_no_formula_duplication(), validate_outcomes_are_binary(), validate_outcomes_are_factors(), validate_outcomes_are_numeric(), validate_outcomes_are_univariate(), validate_prediction_size()

Examples

1
2
3
4
5
6
7
8
# All good
check_predictors_are_numeric(mtcars)

# Species is not numeric
check_predictors_are_numeric(iris)

# This gives an intelligent error message
try(validate_predictors_are_numeric(iris))

DavisVaughan/hardhat documentation built on Oct. 5, 2021, 9:53 a.m.