title: r easy nxn covariance matrix creation with given variances and covariances
body: <p>For a simulation study I need to create nxn covariance matrices. for example I can input 2x2 covariance matrices like</p>
  
  <pre><code>     [,1] [,2]
  [1,] 1.0  1.5
  [2,] 1.5  2.0
  </code></pre>
  
  <p>into a r function/object:</p>
  
  <pre><code>var &lt;- c(1,2) ## variances
  covar &lt;- c(1.5,1.5) ## covariance(s)
  mat &lt;- matrix(c(var[1],covar[1],covar[2],var[2]),ncol=length(var))
  </code></pre>
  
  <p>then I only have to change <code>var</code> &amp; <code>covar</code> values to form the matrices. but unfortunately I'm not just dealing with 2x2s but 2x2:30x30 or even higher! so is it possible to write only one function for any matrix of nxn dimension in r?</p>