Re: [R] Re : calling combinations of variable names

2009-09-08 Thread Helter Two
Thanks to Justin, Baptiste, and Sebed for your answers. The solutions work well. I have been putting them to good use today: the code now works wonderfully and I learnt some useful tricks! thanks, Peter <-Original Message-> >From: justin bem [justin_...@yahoo.fr] >Sent: 9/8/2009 9:06:2

[R] Re : calling combinations of variable names

2009-09-08 Thread justin bem
may be this can work testfun<-function(x) { rval="" k<-length(x) for (i in 1: k) rval<-paste(rval,x[i],sep="-") rval } v1<-paste("evalr",1:4,sep="") eval<-expand.grid(w=v1,x=v1,y=v1,z=v1) n<-dim(eval)[1] results<-rep("", n) for (i in 1:n) { row<-unique(unlist(eval[i,])) if (le