View source: R/preprocess_data.R
update_data | R Documentation |
data
is updated, i.e. unused columns and factor levels are removed as described in
updater
. This is done by reference, i.e. updates the object being passed to data even if nothing is
returned by the function itself.
update_data(data, updater)
data |
data.table. Data that ought to be updated. |
updater |
List. The object should be the output from
|
NULL.
Martin Jullum
# Load example data
if (requireNamespace("MASS", quietly = TRUE)) {
data("Boston", package = "MASS")
# Split data into test- and training data
x_train <- data.table::as.data.table(head(Boston))
x_train[, rad := as.factor(rad)]
data_features <- get_data_specs(x_train)
model <- lm(medv ~ lstat + rm + rad + indus, data = x_train)
model_features <- get_model_specs(model)
updater <- check_features(model_features, data_features)
update_data(x_train, updater)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.