The method also handles NAs in in x and leaves them untouched.
normalize(x, method = "standardize", range = c(0, 1), margin = 1L, on.constant = "quiet")numeric | matrix | data.frame]
Input vector.character(1)]
Normalizing method. Available are:
center: Subtract mean.
scale: Divide by standard deviation.
standardize: Center and scale.
range: Scale to a given range.numeric(2)]
Range for method range.
Default is c(0,1).integer(1)]
1 = rows, 2 = cols.
Same is in apply
Default is 1.character(1)]
How should constant vectors be treated? Only used, of method != center,
since this methods does not fail for constant vectors. Possible actions are:
quiet: Depending on the method, treat them quietly:
scale: No division by standard deviation is done, input values.
will be returned untouched.
standardize: Only the mean is subtracted, no division is done.
range: All values are mapped to the mean of the given range.
warn: Same behaviour as quiet, but print a warning message.
stop: Stop with an error.numeric | matrix | data.frame].
scale