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.
The first value represents the replacement for the min value, the second is the substitute for the max value.
So it is possible to reverse the order by giving range = c(1,0)
.
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