View source: R/preproc-generics.R
| preprocess | R Documentation |
This helper function provides a simple interface for the common preprocessing workflow: fit a preprocessor to data and return both the fitted preprocessor and the transformed data.
preprocess(preproc, X, ...)
preproc |
A preprocessing object (e.g., created with |
X |
A matrix or data frame to preprocess |
... |
Additional arguments passed to methods |
A list with two elements:
preproc |
The fitted preprocessing object |
transformed |
The transformed data matrix |
fit(), fit_transform(), transform(), inverse_transform()
# Simple preprocessing workflow
X <- matrix(rnorm(100), 10, 10)
result <- preprocess(center(), X)
fitted_preproc <- result$preproc
X_centered <- result$transformed
# Equivalent to:
# fitted_preproc <- fit(center(), X)
# X_centered <- transform(fitted_preproc, X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.