preprocess: Convenience function for preprocessing workflow

View source: R/preproc-generics.R

preprocessR Documentation

Convenience function for preprocessing workflow

Description

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.

Usage

preprocess(preproc, X, ...)

Arguments

preproc

A preprocessing object (e.g., created with center(), standardize(), etc.)

X

A matrix or data frame to preprocess

...

Additional arguments passed to methods

Value

A list with two elements:

preproc

The fitted preprocessing object

transformed

The transformed data matrix

See Also

fit(), fit_transform(), transform(), inverse_transform()

Examples

# 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)

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