title: What code to use in R 3.5.1 to count numbers of unique var2 for each unique var1?
body: <p>I have a data with 2 columns. Var1 - school classes, Var2 - names of students in the class. What command can I use to make a new matrix that will show how many times are repeated unique names in var2 for each unique var1?</p>
  
  <pre><code>Var1     Var2
  9      Sarah
  9      John
  12     Sarah
  11     Veronica
  10     John
  10     John
  11     Veronica
  12     John
  12     Veronica
  11     Veronica
  10     Sarah
  9      Veronica
  9      John
  </code></pre>
  
  <p>What command can I use to make a new matrix that      will show how many times are repeated unique names in var2 for each unique var1?</p>
  
  <pre><code> _____Sarah____Veronica__John
  9______1_______1___________2
  10_____1_______0___________1
  11_____0_______3___________0
  12_____1_______1___________1
  </code></pre>
  
  <p>Thank you in advance!</p>