[R] model frame problem
jack306
jixiangwu05 at gmail.com
Fri Oct 28 19:12:41 CEST 2011
Dear R community:
I am working on a model frame problem which is important for my data
analysis. What I am trying to get is to get data set d3 through the model
formula "ff=y~a+b+a*b" and data set d1 to generate a new data set d3 which
includes a interaction column between a and b rather than d2. I have tried
several ways but did not get that done. I would greatly appreciate any help.
The codes are listed as follows:
Jixiang Wu
####################################################
a=c(1:10)
b=c(1:10)
ab=paste(a,b,sep="*")
d1=data.frame(y=rnorm(10),a=a,b=b)
ff=y~a+b+a*b
d2=model.frame(ff,d1) ## this generate from model.frame
d2
d3=data.frame(y=rnorm(10),a=a,b=b,ab=ab) ## this is what I need
d3
--
View this message in context: http://r.789695.n4.nabble.com/model-frame-problem-tp3948602p3948602.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list