fit_minmax: Fit a min-max scaler from a training data frame

View source: R/scale.R

fit_minmaxR Documentation

Fit a min-max scaler from a training data frame

Description

Computes per-column minimum and range from df[, cols]. Constant columns (range == 0) are assigned a range of 1 to avoid division by zero.

Usage

fit_minmax(df, cols)

Arguments

df

A data frame or tibble.

cols

Character vector of column names to include.

Value

A list with elements:

min

Named numeric vector of per-column minima.

rng

Named numeric vector of per-column ranges.

cols

The character vector cols (stored for later use).

Examples

df <- data.frame(sand = c(20, 40, 60), clay = c(30, 20, 10))
sc <- fit_minmax(df, c("sand", "clay"))
sc


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