Skip to contents

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, ...)

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

Value

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

Examples

# 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