The R Project SVN R

Rev

Rev 59039 | Rev 68948 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59039 Rev 61150
Line 46... Line 46...
46
  If \code{scale} is \code{FALSE}, no scaling is done.
46
  If \code{scale} is \code{FALSE}, no scaling is done.
47
 
47
 
48
  The root-mean-square for a (possibly centered) column is defined as
48
  The root-mean-square for a (possibly centered) column is defined as
49
  \eqn{\sqrt{\sum(x^2)/(n-1)}}{sqrt(sum(x^2)/(n-1))}, where \eqn{x} is
49
  \eqn{\sqrt{\sum(x^2)/(n-1)}}{sqrt(sum(x^2)/(n-1))}, where \eqn{x} is
50
  a vector of the non-missing values and \eqn{n} is the number of
50
  a vector of the non-missing values and \eqn{n} is the number of
51
  non-missing values.  In the case \code{center=TRUE}, this is the
51
  non-missing values.  In the case \code{center = TRUE}, this is the
52
  same as the standard deviation, but in general it is not.  (To scale
52
  same as the standard deviation, but in general it is not.  (To scale
53
  by the standard deviations without centering, use
53
  by the standard deviations without centering, use
54
  \code{scale(x,center=FALSE,scale=apply(x,2,sd,na.rm=TRUE))}.)
54
  \code{scale(x, center = FALSE, scale = apply(x, 2, sd, na.rm = TRUE))}.)
55
}
55
}
56
\references{
56
\references{
57
  Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
57
  Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
58
  \emph{The New S Language}.
58
  \emph{The New S Language}.
59
  Wadsworth & Brooks/Cole.
59
  Wadsworth & Brooks/Cole.
Line 64... Line 64...
64
 
64
 
65
  For working with the scale of a plot, see \code{\link{par}}.
65
  For working with the scale of a plot, see \code{\link{par}}.
66
}
66
}
67
\examples{
67
\examples{
68
require(stats)
68
require(stats)
69
x <- matrix(1:10, ncol=2)
69
x <- matrix(1:10, ncol = 2)
70
(centered.x <- scale(x, scale=FALSE))
70
(centered.x <- scale(x, scale = FALSE))
71
cov(centered.scaled.x <- scale(x))# all 1
71
cov(centered.scaled.x <- scale(x)) # all 1
72
}
72
}
73
\keyword{array}
73
\keyword{array}