title: Counting unique variables within a unique variables [R]
body: <p>Suppose this is my data:</p>
  
  <pre><code>X   Y   Z
  1   1   2323   
  1   1   45
  1   1   67 
  1   2   1
  1   2   90
  1   3   34
  1   3   1267
  1   3   623
  1   4   81
  1   4   501
  2   1   456
  2   1   78
  2   2   41
  2   2   56
  2   3   90
  2   3   71
  2   4   24
  2   4   98
  2   5   42
  2   5   361
  </code></pre>
  
  <p>How do I count the values of <code>Z</code> for each unique variable <code>Y</code> for each separate <code>X</code> so that I can get a dataframe that looks like:</p>
  
  <pre><code>X   Y   Z
  1   1   2435
  1   2   91
  1   3   1924
  1   4   582
  2   1   534
  2   2   97
  2   3   161
  2   4   122
  2   5   403
  </code></pre>