Skip to content
Prev 275869 / 398506 Next

R help with different combinations of vectors of different sizes

Another approach is to use expand.grid to create a
data.frame of all possible combinations of elements
of its input vectors:
   rowSums(expand.grid(0:5, 0:5, 0:5))

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com