Does this give you what you want? > x=c(2,4,3,4,5) > ?scale > scale(x,scale=FALSE) [,1] [1,] -1.6 [2,] 0.4 [3,] -0.6 [4,] 0.4 [5,] 1.4 attr(,"scaled:center") [1] 3.6 >
Default is to performance scaling: "If scale is TRUE then scaling is done by dividing the (centered) columns of x by their root-mean-square, and if scale is FALSE, no scaling is done. " On Jan 3, 2008 9:37 PM, tom soyer <[EMAIL PROTECTED]> wrote: > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? ______________________________________________ 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.