normalize: Normalize a numeric vector
Description
This function divides x
by the result of fun(x)
.
Usage
normalize(x, fun = "max", na.rm = TRUE, ...)
Arguments
fun
character or function. Should own an na.rm
argument. fun(x)
should return either one unique value, or a numeric vector of the same length
as x
.
na.rm
Should missing values be removed in the calculation of fun(x)
?
...
Additional arguments to be passed to fun
.
Value
A numeric vector of the same length as x
.
Examples
Run this code# NOT RUN {
x <- rnorm(10)
normalize(x)
# }
Run the code above in your browser using DataLab