linscale: Apply minmax linear scaling to a vector.
Description
Apply minmax linear scaling to a vector.
Usage
linscale(x, minmax = NULL, rev = c(FALSE, TRUE))
Value
Outputs a list with elements:
x - Scaled vector.
minmax - List with resulting mn, mx, mn.orig and mx.orig. Can be used as input to reverse scaling.
Arguments
x
Input vector.
minmax
minmax must be a list with elements "mn", "mx", "mn.orig" and "mx.orig", where "mn" and "mx" refer to the target min and max, and the remaining two refer to the current vector min and max. By default mn=-1 and mx=1. mn.orig and mx.orig can be missing, unless the scaling is reversed.