rescaleVector {virtualPollen} | R Documentation |
Takes a numeric vector x
and rescales it within the values given by new.min
and new.max
.
rescaleVector(
x = rnorm(100),
new.min = 0,
new.max = 100,
integer = FALSE
)
x |
numeric vector to be rescaled. |
new.min |
numeric, new minimum value for |
new.max |
numeric, new maximum value for |
integer |
boolean, if TRUE, output vector is returned as vector of integers. Default is FALSE. |
A vector of the same length as x
rescaled between output.min
and output.max
.
Blas M. Benito <blasbenito@gmail.com>
#generating example data
x = rnorm(100)
#as float
x.float <- rescaleVector(
x = x,
new.min = 0,
new.max = 100,
integer = FALSE
)
#as integer
x.integer <- rescaleVector(
x = x,
new.min = 0,
new.max = 100,
integer = TRUE
)