[R] order of interaction coeff in lm

slurpy sunayan at gmail.com
Mon Oct 19 05:45:05 CEST 2009


Hi. I haven't found this question asked elsewhere, so I hope I am not missing
something trivial. 

y<-rnorm(1:10)
x1<-rnorm(1:10)
x2<-rnorm(1:10)
x3<-rnorm(1:10)
x4<-rnorm(1:10)
reg<-lm(y~x1*x2+x3+x4)
summary(reg)

The output of this puts x1:x2 after x3 and x4. In my case this is very
cumbersome because I have about 50 dummy variables instead of just x3 and
x4. Is there any way I can get R to print out x1:x2 right after x1 and x2? I
can always do:

x1_x2<-x1*x2
reg<-lm(y~x1+x2+x1_x2+x3+x4)

But I was wondering if there is something more elegant, since I like the
interaction term denoted by a colon.

Thanks.
############
R 2.9.2/vista x64
-- 
View this message in context: http://www.nabble.com/order-of-interaction-coeff-in-lm-tp25952978p25952978.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list