View source: R/check_augment_data_specification.R
check_augment_data_specification | R Documentation |
Call this function to perform tests. If a tests fails, an informative error will be thrown. Otherwise silent.
Uses augment_data_helper()
to create copies of the same dataset as
a tibble, data frame and dataframe with rownames. When add_missing = TRUE
these
datasets have missing values along the diagonal, and one row of entirely missing
values. Once the datasets have been generated, tests that:
augment(fit, data = generated_dataset)
passes check_tibble()
for each
generated dataset.
Output of augment(fit, data = generated_dataset)
is the same for all three
generated datasets, except the data frame with rownames should also generate
a .rownames
column that the tibble and nameless data frame do not.
Additional tests when test_newdata = TRUE
:
head(aug(model, newdata = data))
equals aug(head(model, newdata = data))
.
This commutativity check catches issues where the output of predict
changes
for the same data point depending on the rest of the dataset.
check_augment_data_specification(aug, model, data, add_missing, test_newdata)
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 |
add_missing |
Logical indicating whether or not missing data should be
introduced into the datasets generated with |
test_newdata |
Logical indicating whether the |
An invisible NULL
. This function should be called for side effects, not return values.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.