The R Project SVN R

Rev

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

Rev 68948 Rev 74341
Line 1... Line 1...
1
% File src/library/base/man/scale.Rd
1
% File src/library/base/man/scale.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2014 R Core Team
3
% Copyright 1995-2018 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{scale}
6
\name{scale}
7
\alias{scale}
7
\alias{scale}
8
\alias{scale.default}
8
\alias{scale.default}
Line 14... Line 14...
14
\usage{
14
\usage{
15
scale(x, center = TRUE, scale = TRUE)
15
scale(x, center = TRUE, scale = TRUE)
16
}
16
}
17
\arguments{
17
\arguments{
18
  \item{x}{a numeric matrix(like object).}
18
  \item{x}{a numeric matrix(like object).}
19
  \item{center}{either a logical value or a numeric vector of length
19
  \item{center}{either a logical value or numeric-alike vector of length
20
    equal to the number of columns of \code{x}.}
20
    equal to the number of columns of \code{x}, where
-
 
21
    \sQuote{numeric-alike} means that \code{\link{as.numeric}(.)} will
-
 
22
    be applied successfully if \code{\link{is.numeric}(.)} is not true.}
21
  \item{scale}{either a logical value or a numeric vector of length
23
  \item{scale}{either a logical value or a numeric-alike vector of length
22
    equal to the number of columns of \code{x}.}
24
    equal to the number of columns of \code{x}.}
23
}
25
}
24
\value{
26
\value{
25
  For \code{scale.default}, the centered, scaled matrix.  The numeric
27
  For \code{scale.default}, the centered, scaled matrix.  The numeric
26
  centering and scalings used (if any) are returned as attributes
28
  centering and scalings used (if any) are returned as attributes
27
  \code{"scaled:center"} and \code{"scaled:scale"}
29
  \code{"scaled:center"} and \code{"scaled:scale"}
28
}
30
}
29
\details{
31
\details{
30
  The value of \code{center} determines how column centering is
32
  The value of \code{center} determines how column centering is
31
  performed.  If \code{center} is a numeric vector with length equal to
33
  performed.  If \code{center} is a numeric-alike vector with length equal to
32
  the number of columns of \code{x}, then each column of \code{x} has
34
  the number of columns of \code{x}, then each column of \code{x} has
33
  the corresponding value from \code{center} subtracted from it.  If
35
  the corresponding value from \code{center} subtracted from it.  If
34
  \code{center} is \code{TRUE} then centering is done by subtracting the
36
  \code{center} is \code{TRUE} then centering is done by subtracting the
35
  column means (omitting \code{NA}s) of \code{x} from their
37
  column means (omitting \code{NA}s) of \code{x} from their
36
  corresponding columns, and if \code{center} is \code{FALSE}, no
38
  corresponding columns, and if \code{center} is \code{FALSE}, no
37
  centering is done.
39
  centering is done.
38
 
40
 
39
  The value of \code{scale} determines how column scaling is performed
41
  The value of \code{scale} determines how column scaling is performed
40
  (after centering).  If \code{scale} is a numeric vector with length
42
  (after centering).  If \code{scale} is a numeric-alike vector with length
41
  equal to the number of columns of \code{x}, then each column of
43
  equal to the number of columns of \code{x}, then each column of
42
  \code{x} is divided by the corresponding value from \code{scale}.
44
  \code{x} is divided by the corresponding value from \code{scale}.
43
  If \code{scale} is \code{TRUE} then scaling is done by dividing the
45
  If \code{scale} is \code{TRUE} then scaling is done by dividing the
44
  (centered) columns of \code{x} by their standard deviations if
46
  (centered) columns of \code{x} by their standard deviations if
45
  \code{center} is \code{TRUE}, and the root mean square otherwise.
47
  \code{center} is \code{TRUE}, and the root mean square otherwise.