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))
   X1    X2 X1:X2
-1.77  0.83  1.25
R>
R>


OK, so far so good.  But change the column names of 'x' and the behaviour
changes:


colnames(x) <- c("d","nd")   # 'd' == 'death' and 'nd' == 'no death'
coef(lm(d~ -1 + (.)^2,data=x))
       nd
0.2962963



I am not sure if this is consistent with the special meaning of '.'
described under ?formula.

Is this the intended behaviour?


-- 
Robin Hankin
Uncertainty Analyst
hankin.ro...@gmail.com

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to