fit_transform: Fit and transform data in one step

View source: R/preproc-generics.R

fit_transformR Documentation

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

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)

See Also

fit(), transform(), inverse_transform()

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

multivarious documentation built on Jan. 22, 2026, 1:06 a.m.