Ensure that the outcome has only factor columnsSource:
validate - asserts the following:
outcomesmust have factor columns.
check - returns the following:
okA logical. Does the check pass?
bad_classesA named list. The names are the names of problematic columns, and the values are the classes of the matching column.
check_outcomes_are_factors() returns a named list of two components,
The expected way to use this validation function is to supply it the
$outcomes element of the result of a call to
hardhat provides validation functions at two levels.
check_*(): check a condition, and return a list. The list always contains at least one element,
ok, a logical that specifies if the check passed. Each check also has check specific elements in the returned list that can be used to construct meaningful error messages.
validate_*(): check a condition, and error if it does not pass. These functions call their corresponding check function, and then provide a default error message. If you, as a developer, want a different error message, then call the
check_*()function yourself, and provide your own validation function.