[R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

Duncan Murdoch murdoch.duncan at gmail.com
Mon May 23 13:41:57 CEST 2016


On 23/05/2016 7:26 AM, John Sorkin wrote:
>
> The syntax
> mydat <- data.frame( y,x )
> fit1 <- lm( y~., data=mydat )
> appears to perform a multivariable regression of y on every non-y variable in the data frame mydat. I can not find this syntax (y~.) in R documentation. Is y~. a supported feature of the R language? Where can I find it documented? I would hate to write code that is dependent on a non-supported, non-documented language feature.

It is documented in the Introduction to R manual (hidden in section 
11.5, "Updating fitted models"), and in ?formula, which ?lm refers to.

Duncan Murdoch



More information about the R-help mailing list