Displaying 1 result from an estimated 1 matches for "multiperm".
Did you mean:
multipart
2006 Oct 24
0
incorrect number of subscriptions error in user-written function
...ot;5 chosen from 8" combined with "2 chosen from 4".
Loading gtools I can generate the combinations for each selection
sec1 = combinations(4,2,1:4)
sec2 = combinations(6,3,5:10)
sec3 = combinations(8,5,11:18)
I then wrote a function to combine the combinations for each selection.
multiperm <-function(x, y) # function to combine combinations
{
xdim = nrow(x)
xcol = ncol(x)
ydim = nrow(y)
ycol = ncol(y)
v1 = matrix( nrow = xdim*ydim, ncol = xcol+ycol )
for ( i in 1:xdim) {
for (j in 1:ydim){
v1[i + (j-1)*xdim , ] = c(x[i,], y[j, ])}
}
v1 = data.frame(v1) # set o...