title: R - counting occurences and multiply by rank
body: <p>I am unable to replicate a way of applying lists to occurences (or counts). </p>
  
  <p>I've been toying around with <code>rowSums()</code> but I can't figure out how to use it in a general way over multiple columns, which also should be multiplied by <em>rank</em> (see <strong>rank.list</strong> below)</p>
  
  <p>My data is shown below, what I want to do is:</p>
  
  <ul>
  <li>1) Count the number of occurences per column (a form of communication)</li>
  <li>2) Multiply that number by a given rank. Thus, one specific occurence might give +1, 0 or -1.</li>
  <li>3) Which should result in <code>rowSums()</code>(?) over the columns in question.</li>
  </ul>
  
  <p><strong>Example</strong>: first 4 columns, 4th row:</p>
  
  <p><em>Bewustwording</em> (1x +1) + <em>Confrontatie</em> (2x -1) + <em>Coordinerend</em> (17x +1 ) would equal 1 - 2 + 17 = <strong>18</strong></p>
  
  <pre><code>       Bewustwording Confrontatie Confrontatie.Outside Coordinerend Delegerend Goedaardig Grappig
  1              1            0                    0            1          6          3       0
  2              0            1                    0            3          3          0       1
  3              1            0                    0            6          2          5       0
  4              1            2                    0           17         22          4       0
  5              0            0                    0            2          0          0       0
  6              0            0                    0            4          9          7       2
  7              0            0                    0           10          6          3       0
  8              0            1                    0            6          1          2       1
  9              1            1                    0           14         15          9       1
  10             1            2                    0            9         11          1       1
  </code></pre>
  
  <p>We want to use this positive/negative attributing in order to ascertain if a given form of  communication is more present than other situations. Quite basic, but would allow for more interesting hypotheses to continue on since we are working with a lot of different groups (or subsets).</p>
  
  <p>Ideally I would slap this list on the (or any) data which would sprout a new column with a new value (which is 18 in the example above). Sometimes a ranking value might change or has to be corrected, applying the changes should not take too much effort. I will probably not be doing this after this is done, hence the easy way for others. However, still clueless on how to :)</p>
  
  <pre><code>&gt; rank.list
                   Action rank
  1         Bewustwording    1
  2          Confrontatie   -1
  3  Confrontatie.Outside   -1
  4          Coordinerend    1
  5            Delegerend    1
  6            Goedaardig    1
  7               Grappig    1
  8              Hofmaken    1
  9           Instruerend    1
  10         Onderwijzend    1
  11           Ontbindend    0
  12              Protest   -1
  13             Reactief    0
  14     Respons.Negatief   -1
  15     Respons.Neutraal    0
  16     Respons.Positief    1
  17             Sign-out    0
  18             Time-out    0
  19             Volgzaam    1
  20              Vragend    1
  </code></pre>
  
  <p>Output: ideally output such as <strong>Ranking</strong> (for the first 2 rows)</p>
  
  <pre><code>       Bewustwording Confrontatie Confrontatie.Outside Coordinerend   Ranking
  1              1            0                    0            1          2            
  2              0            1                    0            3          2        
  </code></pre>