rescaleVector {virtualPollen} | R Documentation |
Rescales a vector within given bounds.
Description
Takes a numeric vector x
and rescales it within the values given by new.min
and new.max
.
Usage
rescaleVector(
x = rnorm(100),
new.min = 0,
new.max = 100,
integer = FALSE
)
Arguments
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. |
Value
A vector of the same length as x
rescaled between output.min
and output.max
.
Author(s)
Blas M. Benito <blasbenito@gmail.com>
Examples
#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
)
[Package virtualPollen version 1.0.1 Index]