I have a matrixp, each column is an argument of function expand.grid, how do I have something like expand.grid(p[,1],p[,2],...)?
CodePudding user response:
We may convert the matrix to a list of vectors and apply expand.grid
expand.grid(asplit(p, 2))
CodePudding user response:
You could also do:
expand.grid(data.frame(p))
