title: do.call cbind and sapply in R
body: <p>I have a list of all possible combinations between the columns of a given matrix. I would like to compute the cov of each combination and finally the determinant of each covariance matrix.</p>
  
  <p>The problem is that I need to compute a squared matrix before calculating the determinant, I tried to use do.call with cbind and sapply all together but does not work:</p>
  
  <pre><code>matrices.sq=do.call("cbind",lapply(list.of.matrices,get))
  </code></pre>
  
  <p>The code is the following:</p>
  
  <pre><code>myarray=matrix(rexp(200),50,5)
  list.of.matrices &lt;- apply(expand.grid(rep(list(c(FALSE, TRUE)), ncol(myarray))),
                                1, function(j)myarray[, j, drop = FALSE])
  list.of.cov.matrices=sapply(list.of.matrices, cov)
  list.of.cov.matrices.2=list.of.cov.matrices[-(1:ncol(myarray))] #so get those with more than one column
  list.of.det&lt;- sapply(list.of.cov.matrices.2, det)
  </code></pre>