undo_minmax: Reverse minmax scaling of numeric vector

Description Usage Arguments Value Examples

View source: R/pre_processing.R

Description

Helper function to reverse minmax scaling applied in the pre-processing step.

Usage

1
undo_minmax(s, s_min, s_max)

Arguments

s

A numeric vector or column, scaled between 0 and 1.

s_min

A numeric value, the minimum of the unscaled vector

s_max

A numeric value, the maximum of the unscaled vector

Value

Vector re-scaled using original parameters s_min and s_max

Examples

1
2
3
4
5
6
ex_num <- runif(100,1,10)
scaled <- col_minmax(ex_num)
undo_scale <- undo_minmax(scaled, s_min = min(ex_num), s_max = max(ex_num))

# Prove two are identical
all.equal(ex_num, undo_scale)

rMIDAS documentation built on Jan. 30, 2021, 9:05 a.m.