Learn R Programming

multivarious (version 0.3.1)

fit_transform: Fit and transform data in one step

Description

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.

Usage

fit_transform(object, X, ...)

Value

A list with two elements: preproc (the fitted preprocessor) and transformed (the transformed data)

Arguments

object

A preprocessing object (e.g., prepper or pre_processor)

X

A matrix or data frame to fit and transform

...

Additional arguments passed to methods

See Also

fit(), transform(), inverse_transform()

Examples

Run this code
# 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

Run the code above in your browser using DataLab