fitrange: Fit to a range

Description Usage Arguments See Also Examples

View source: R/fitrange.R

Description

Linearly shift and scale a numeric vector so that it fits to a given range.

Usage

1
fitrange(x, lower = -1, upper = 1)

Arguments

x

a numeric vector

lower

the lower bound of the new vector

upper

the upper bound of the new vector

See Also

norma

Examples

1
2
3
4
5
range(fitrange(runif(10, -2, 1.5), 0, 1))

fitrange(c(2, 3, 5, 7, 4), 1, 0)
# same, but without warning
1 - fitrange(c(2, 3, 5, 7, 4), 0, 1)

AkselA/R-ymse documentation built on March 21, 2020, 9:52 a.m.