It isn't lm but terms.formula. Compare terms(dat$y ~ .,data = dat) terms(dat[, 1] ~ ., data = dat)
Now as to why, exactly, see the C code in src/main/model.c. The short answer is that dat$y matches y, and dat[, 1] does not. (I am not at all sure the first is intentional.) On Wed, 24 Mar 2004, Baskin, Robert wrote: > First: Thanks to everyone who develops R, maintains r-help, and participates > in the list :) > > This is a silly follow up question. > > >From Andy Liaw: > > dat <- data.frame(y=rnorm(10), x1=rnorm(10), x2=rnorm(10)) > > (Silly question - if the answer is on the lm or formula help page I didn't > get it:) > Why does lm | formula treat dat[,1] slightly differently than dat$y? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
