An aside to the main question:
I don't think that
i+1:3
is doing what you think it is.
On 26/03/2010 23:01, casperyc wrote:
Hi,
I am tring to write a loop to compute this,
==========================
x1=c(
rep(-1,4),
rep(1,4)
)
x2=c(
rep(c(-1,-1,1,1),2)
)
x3=c(
rep(c(-1,1),4)
)
x1*x2
x1*x3
x2*x3
========================
suppose i have x1,x2,x3
i want to compute their ' two factor interactions', x1x2,x1x3 and x2x3,
I wrote
========================
for(i in 1:2){
for( j in i+1:3){
xij=c()
xij=xi*xj
}
}
========================
it did not seem to recognize xi and xj
is there any suggestion?
it would be wonderful if there exists a single command that i can use
My ultimate aim is to find the 55 xixj s of the following data:
http://n4.nabble.com/file/n1692945/test_pic.jpg test_pic.jpg
Thanks.
--
Patrick Burns
[email protected]
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.