Skip to content

Commit d7b8b7e

Browse files
update documentation of lm (subset argument)
1 parent aa687cd commit d7b8b7e

File tree

1 file changed

+7
-4
lines changed
  • src/library/stats/man

1 file changed

+7
-4
lines changed

src/library/stats/man/lm.Rd

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ lm(formula, data, subset, weights, na.action,
3535
typically the environment from which \code{lm} is called.}
3636

3737
\item{subset}{an optional vector specifying a subset of observations
38-
to be used in the fitting process. (See additional details about how
39-
this argument interacts with data-dependent bases in the
40-
\sQuote{Details} section of the \code{\link{model.frame}}
41-
documentation.)}
38+
to be used in the fitting process. (See additional details about how
39+
this argument interacts with data-dependent bases under \sQuote{Details}
40+
below.)
4241

4342
\item{weights}{an optional vector of weights to be used in the fitting
4443
process. Should be \code{NULL} or a numeric vector.
@@ -132,6 +131,10 @@ lm(formula, data, subset, weights, na.action,
132131
All of \code{weights}, \code{subset} and \code{offset} are evaluated
133132
in the same way as variables in \code{formula}, that is first in
134133
\code{data} and then in the environment of \code{formula}.
134+
Note that values calculated inside the formula, such as \code{mean(x)},
135+
are evaluated before subsetting - which may lead to unexpected results
136+
if used with \code{subset}. For more information see the
137+
\sQuote{Details} section of the \code{\link{model.frame}}.
135138
}
136139
\value{
137140
\code{lm} returns an object of \code{\link{class}} \code{"lm"} or for

0 commit comments

Comments
 (0)