title: variance covariance matrix by group
body: <p>I am very new at R and am struggling to create a matrix. My eventual goal is to produce a variance covariance matrix comparing 6 numeric variables (columns) by groups. I have 2187 rows of data,  which are divided among to several hundred groups. I tried to create a matrix with variations of the following, using the help(matrix) information. This gives me a matrix that is the correct size, but filled with x,y information based on the structure of the database: </p>
  
  <blockquote>
    <p>matrix(data = PhenoM, nrow = 2187, ncol = 6, byrow = FALSE, dimnames = NULL)</p>
  
  <pre><code>    [,1]       [,2]      [,3]       [,4]       [,5]       [,6]
  </code></pre>
    
    <p>[,1] factor,2187 Integer,2187    Integer,2187    Numeric,2187    Numeric,2187    .factor,2187 </p>
    
    <p>[,2]    factor,2187     Numeric,2187    Numeric,2187    Numeric,2187    factor,2187     Integer,2187</p>
    
    <p>[,3]   factor,2187     Numeric,2187    Numeric,2187    Numeric,2187    factor,2187     Numeric,2187</p>
  </blockquote>
  
  <p>I'm also not sure how to instruct R that the 6 columns of information I want in the matrix are the last 6 of 13 (read right to left). Thank you for your help!</p>