Hi,

The documentation for scale() states:"If center is TRUE then centering is
done by subtracting the column means (omitting NAs) of x from their
corresponding columns". But it seems that R is subtracting something else
instead of the column mean:

> x=c(2,4,3,4,5)
> mean(x)
[1] 3.6
> x-mean(x)
[1] -1.6  0.4 -0.6  0.4  1.4
> scale(x)
           [,1]
[1,] -1.4032928
[2,]  0.3508232
[3,] -0.5262348
[4,]  0.3508232
[5,]  1.2278812
attr(,"scaled:center")
[1] 3.6
attr(,"scaled:scale")
[1] 1.140175

Notice that -1.4 is not the same as -1.6, and 1.2 is not the same as 1.4,
etc. Does anyone know what exactly is scale() doing if it is not subtracting
the column mean? Thanks.

-- 
Tom

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to