Dear All, I have a data frame (mydata), with let say 5 columns V1,V2,...,V5. (we know the power set of {V1,V2,..,V5} has 2^5-1 elements). I need to construct a vector T of length 5 which its i-th element is the maximum of (let say) mean values obtained based on the columns subset of size i. I mean: T[1]=max(mean(mydata[,1]),...,mean(mydata[,5])) T[2]=max(mean(mydata[,c(1,2)],mean(mydata[,c(1,3)],...,mean(mydata[,c(1,5]) T[3]=max(mean(mydata[,c(1,2,3)],mean(mydata[,c(1,2,4)],...,mean(mydata[,c(3,4,5)]) .... T[5]=max(mean(mydata[,c(1,2,3,4,5)] Many thanks in advance. Hamid