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. -- View this message in context: http://n4.nabble.com/R-loop-help-tp1692945p1692945.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.