Check new data to ensure it has the required variables and classes
check_newdata(newdata, olddata, req_vars, exclude = FALSE)
`TRUE`, if required variables are present in `newdata`, and required variables are of the same class in `newdata` and `olddata`. Otherwise, this function will stop with an error.
A `data.frame` containing new data
A `data.frame` containing existing data. `newdata` variable classes will be required to match `olddata`
A `character` vector of required variable names that must appear in `newdata`
Logical: Whether a variable `"exclude"` also must be present in `newdata`
Caroline Ring
This is a helper function to check new data to ensure it has the required variables and that those variables are of the correct classes. This is useful, for example, when making predictions from a fitted [pk()] model object on new data.