title: Row and column sums in R
body: <p>This is an example of how my data set (<code>MergedData</code>) looks like in R, where each of my participants (5 rows) obtained a score number in every test (7 columns). I would like to know the total score of all tests combined (all columns) but for each participant (row).</p>
  
  <p>Also, my complete data set has more than just these few variables, so if possible, I would like do it using a formula &amp; loop and not having to type row by row/column by column. </p>
  
  <pre><code>Participant TestScores     
  ParticipantA    2   4   2   3   2   3   4
  ParticipantB    1   3   2   2   3   3   3
  ParticipantC    1   4   4   2   3   4   2
  ParticipantD    2   4   2   3   2   4   4
  ParticipantE    1   3   2   2   2   2   2
  </code></pre>
  
  <p>I have tried this but it doesn't work: </p>
  
  <pre><code>Test_Scores &lt;- rowSums(MergedData[Test1, Test2, Test3], na.rm=TRUE)
  </code></pre>
  
  <p>I get the following error-message:</p>
  
  <pre><code>Error in `[.data.frame`(MergedData, Test1, Test2, Test3,  : 
    unused arguments
  </code></pre>
  
  <p>How do I solve this? Thank you!!</p>