pellegrini <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> There is something that I do not get with scale function. > > Say that I have a vector v <- c(1,2,3,4,5,6), > > scale(v,center=TRUE,scale=TRUE) gives a new vector with 0 as mean > and 1 as standard deviation. > > but, > > scale(v, center=FALSE,scale=TRUE) gives a new vector with a standard > deviation different from 1. > > I would also expect a standard deviation of 1 in that case. > > am I wrong ? Appears that you are. From the help page: "If scale is TRUE then scaling is done by dividing the (centered) columns of x by their root-mean-square." "The root-mean-square for a column is obtained by computing the square- root of the sum-of-squares of the non-missing values in the column divided by the number of non-missing values minus one." > sd(scale(warpbreaks$breaks, scale=TRUE)) #default is center=TRUE [1] 1 > sd(scale(warpbreaks$breaks, center=FALSE, scale=TRUE)) [1] 0.4212988 -- David Winsemius ______________________________________________ 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.