title: Unable to calculate mean using aggregate for table, result comes out as N/A
body: <p>Currently using R to calculate the mean and standard deviation for each combination of Sex and Genotype in a given table:</p>
  
  <pre><code>id Sex     Genotype  Activity
    1 male    ff        1.884 
    2 male    ff        2.283 
    3 male    fs        2.396 
    4 female  ff        2.838   
    5 male    fs        2.956 
    6 female  ff        4.216 
    7 female  ss        3.620 
  </code></pre>
  
  <p>I made a table called tabled using the function</p>
  
  <pre><code>tabled &lt;- table(data$Sex, data$Genotype)
  </code></pre>
  
  <p>When I try calculating the mean I try the following function:</p>
  
  <pre><code>aggregate(data$Sex ~ data$Genotype, by=list(data$Genotype), FUN=mean)
  </code></pre>
  
  <p>The output I get is </p>
  
  <pre><code>Group.1 data$Sex
  &lt;fctr&gt; &lt;dbl&gt;
  ff     NA           
  fs     NA           
  ss     NA           
  3 rows
  </code></pre>
  
  <p>What am I doing wrong? 
  Thanks!</p>