title: Compute the mean for each subject for different conditions
body: <p>Although I know how to compute the mean in R, I can't seem to understand how to do it for different conditions. Other posts that I have read were not as complicated.</p>
  
  <pre><code>&gt;      Target/dictractor    TrialType    Bin0    Bin1    Bin2    Bin3
  1          Target              2C           3       0       2       0
  1          Target              2C           2       0       3       0
  1          Target              2E           0       1       1       2
  1          Target              2E           0       0       0       0
  1        Distractor            2C           0       3       0       1
  1        Distractor            2C           0       0       0       0
  1        Distractor            2E           0       0       1       0
  1        Distractor            2E           0       0       0       3
  2          Target              2C           1       1       0       1
  2          Target              2C           2       0       0       2
  2        Distractor            2E           0       0       0       0
  2        Distractor            2E           0       0       0       0
  </code></pre>
  
  <p>Given the data set above I would like to get the mean of each bin (<code>Bin0</code>, <code>Bin1</code>, <code>Bin2</code>) for each subject for each <code>TrialType</code> for <code>Target/dictractor</code> separately. For example, for subject 1 I would like to compute the mean of each bin, for <code>TrialType</code> <code>2C</code>, in a <code>Target</code> condition, then the mean for each bin for <code>TrialType</code> <code>2E</code> in a <code>Target</code> condition, then mean for each bin for <code>TrialType</code> <code>2C</code> in <code>Distractor</code> condition and <code>TrialType</code> <code>2E</code> in <code>Distractor</code>. </p>