Displaying 1 result from an estimated 1 matches for "mycombos".
2013 Mar 25
2
Faster way of summing values up based on expand.grid
Hello!
# I have 3 vectors of values:
values1<-rnorm(10)
values2<-rnorm(10)
values3<-rnorm(10)
# In real life, all 3 vectors have a length of 25
# I create all possible combinations of 4 based on 10 elements:
mycombos<-expand.grid(1:10,1:10,1:10,1:10)
dim(mycombos)
# Removing rows that contain pairs of identical values in any 2 of
these columns:
mycombos<-mycombos[!(mycombos$Var1 == mycombos$Var2),]
mycombos<-mycombos[!(mycombos$Var1 == mycombos$Var3),]
mycombos<-mycombos[!(mycombos$Var1 == mycombos$...