apply_minmax: Apply a fitted min-max scaler to a data frame

View source: R/scale.R

apply_minmaxR Documentation

Apply a fitted min-max scaler to a data frame

Description

Scales df[, scaler$cols] using the precomputed min/range. Returns a numeric matrix with the same column order as scaler$cols.

Usage

apply_minmax(df, scaler)

Arguments

df

A data frame or tibble.

scaler

A scaler object returned by fit_minmax().

Value

A numeric matrix scaled to approximately [0, 1] per column. Columns correspond to scaler$cols.

Examples

df_train <- data.frame(sand = c(20, 40, 60), clay = c(30, 20, 10))
sc       <- fit_minmax(df_train, c("sand", "clay"))
df_new   <- data.frame(sand = c(50, 25), clay = c(15, 28))
apply_minmax(df_new, sc)


soilFlux documentation built on Dec. 4, 2026, 5:10 p.m.