Skip to content
Prev 306733 / 398506 Next

Is there any R function for data normalization?

On 12-10-02 5:51 AM, Rui Esteves wrote:
No, but it is easy to construct one using sweep.  First subtract column 
mins, then divide by column maxes:

normalize <- function(x) {
   x <- sweep(x, 2, apply(x, 2, min))
   sweep(x, 2, apply(x, 2, max), "/")
}

Duncan Murdoch