Suppose I have three matrices, such as the following:

mat1 <- Matrix(rnorm(9), 3)
mat2 <- Matrix(rnorm(9), 3)
mat3 <- Matrix(rnorm(9), 3)

I now need to column bind these and I could do the following if there were only two of those matrices because cbind2() has an x and y argument

Zlist <- c(mat1, mat2)
Z <- do.call(cbind2, Zlist)

The following would not work as noted in the help page for cbind2() and I don't think I want to activate cbind() here.

Zlist <- c(mat1, mat2, mat3)
Z <- do.call(cbind2, Zlist)

So, the object I would want in the end would be
Ztmp <- cbind2(mat1, mat2)
Z <- cbind2(Ztmp, mat3)

I never have a large number of these things to combine, so I have solved the problem with a simple loop over the list.

I'm curious though if there is a better (and perhaps) more reliable way to do this?

Thanks,
Harold

	[[alternative HTML version deleted]]

