validate_outcomes_are_numeric {hardhat}R Documentation

Ensure outcomes are all numeric

Description

validate - asserts the following:

check - returns the following:

Usage

validate_outcomes_are_numeric(outcomes)

check_outcomes_are_numeric(outcomes, ..., call = caller_env())

Arguments

outcomes

An object to check.

...

These dots are for future extensions and must be empty.

call

The call used for errors and warnings.

Details

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

Value

validate_outcomes_are_numeric() returns outcomes invisibly.

check_outcomes_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_univariate(), validate_prediction_size(), validate_predictors_are_numeric()

Examples

# All good
check_outcomes_are_numeric(mtcars)

# Species is not numeric
check_outcomes_are_numeric(iris)

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

[Package hardhat version 1.4.1 Index]