check_augment_function {modeltests} | R Documentation |
Check an augment method
Description
Call this function to perform tests. If a tests fails, an informative error will be thrown. Otherwise silent.
Test when strict = FALSE
:
-
aug(model, data = data)
passescheck_tibble()
-
aug(model, newdata = newdata)
passescheck_tibble()
Additional tests when strict = TRUE
:
-
aug(model, data = data)
passescheck_augment_data_specification()
. -
aug(model, newdata = newdata)
passescheck_augment_data_specification()
. -
aug(model, newdata = newdata)
passescheck_augment_data_specification()
withadd_missing = TRUE
. If
aug
has anewdata
argument, thenewdata
argument takes precedence over adata
argument, i.e. callscheck_augment_newdata_precedence()
.-
aug
either gives an informative error or produces a reasonable tibble, i.e. callscheck_augment_no_data()
.
Note that it doesn't make sense to test that aug(model, data = data)
passes check_augment_data_specification()
with add_missing = TRUE
. This is
because the user is already guaranteeing that data
is the original dataset
used to create model
.
Usage
check_augment_function(aug, model, data = NULL, newdata = NULL, strict = TRUE)
Arguments
aug |
An augment method. For example, |
model |
A fit model object to call the augment method on. |
data |
A data frame or tibble to use when testing |
newdata |
A dataset to use to check the |
strict |
Logical indicating whether the strict version of tests should be used. Defaults
to |
Value
An invisible NULL
. This function should be called for side effects, not return values.