View source: R/preproc-generics.R
| fit_transform | R Documentation |
Convenience function that fits a preprocessing pipeline to data and
immediately applies the transformation. This is equivalent to calling
fit() followed by transform() but is more efficient and convenient.
fit_transform(object, X, ...)
object |
A preprocessing object (e.g., |
X |
A matrix or data frame to fit and transform |
... |
Additional arguments passed to methods |
A list with two elements: preproc (the fitted preprocessor) and transformed (the transformed data)
fit(), transform(), inverse_transform()
# Fit and transform in one step
X <- matrix(rnorm(100), 10, 10)
preproc <- center()
result <- fit_transform(preproc, X)
fitted_preproc <- result$preproc
X_transformed <- result$transformed
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.