[R] how to get the sample size in lm

Marc Schwartz marc_schwartz at comcast.net
Thu Oct 11 22:37:44 CEST 2007

On Thu, 2007-10-11 at 11:41 -0700, Jiong Zhang, PhD wrote:
> Hi All,
> How do I get the sample size in lm? I know it is not reported by "summary".
> Thanks.
> jiong

You need to be careful to understand the difference between the sample
size in the original data frame and the actual sample size used in the
creation of the model. Missing data may contribute to a reduction in
sample size depending upon the value of 'na.action'.

See the 'na.action' argument in ?lm for more information.

In general however, you can use:


See ?model.frame for more information.


Marc Schwartz

More information about the R-help mailing list