Skip to content
Prev 306738 / 398521 Next

Is there any R function for data normalization?

Hello,

Try the following.

fun <- function(x){
     a <- min(x)
     b <- max(x)
     (x - a)/(b - a)
}

mat <- matrix(rnorm(12), ncol=3)
apply(mat, 2, fun)

Hope this helps,

Rui Barradas
Em 02-10-2012 10:51, Rui Esteves escreveu: