Re: [Rd] columnames changes behaviour of formula

2012-05-24 Thread Joshua Wiley
P.S. It really is sloppy code to mix variables from the global environment with those inside a data frame. I.e.: coef(lm(d ~ -1 + (.)^2, data = x)) the only time I think it makes sense to have different objects for the outcome and predictors are when for speed purposes, you are using a low level

Re: [Rd] columnames changes behaviour of formula

2012-05-24 Thread Joshua Wiley
Hi Robin, Seems like the intended behavior to me. From the docs: "There are two special interpretations of '.' in a formula. The usual one is in the context of a 'data' argument of model fitting functions and means 'all columns not otherwise in the formula' " d is in the formula so the only col

[Rd] columnames changes behaviour of formula

2012-05-24 Thread robin hankin
Hello. precompiled R-2.15.0, svn58871, macosx 10.7.4. I have discovered that defining column names of a dataframe can alter the behaviour of lm(): d <- c(4,7,6,4) x <- data.frame(cbind(0:3,5:2)) coef(lm(d~ -1 + (.)^2,data=x)) X1X2 X1:X2 -1.77 0.83 1.25 R> R> OK, so far so good. But