title: Counting Number of Rows in R data.frame and Storing as Additional Variable
body: <p>I have a data frame that returns two column variables - word1 and word2 like this:</p>
  
  <pre><code>head(bigrams_filtered2, 20)
  # A tibble: 20 x 2
     word1       word2      
     &lt;chr&gt;       &lt;chr&gt;      
   1 practice    risk       
   2 risk        management 
   3 management  rational   
   4 rational    meansend   
   5 meansend    based      
   6 based       process    
   7 process     risks      
   8 risks       identified 
   9 identified  analysed   
  10 analysed    solved     
  11 solved      mitigated  
  12 objective   involves   
  13 involves    human      
  14 human       perceptions
  15 perceptions biases     
  16 opportunity jack       
  17 differences stakeholder
  18 stakeholder perceptions
  19 perceptions broader    
  20 broader     risk  
  </code></pre>
  
  <p>I am trying to add two additional column variables to this data.frame so that my output looks like this:</p>
  
  <pre><code>##     word1     word2    n totalbigrams           tf
  ## 1     st     louis 1930      3426965 0.0005631805
  ## 2  happy  birthday 1802      3426965 0.0005258297
  ## 3      1         2 1701      3426965 0.0004963576
  ## 4    los   angeles 1385      3426965 0.0004041477
  ## 5 social     media 1256      3426965 0.0003665051
  ## 6    san francisco 1245      3426965 0.0003632952
  </code></pre>
  
  <p>I'm following an example from here <a href="http://www.rpubs.com/pnice421/347328" rel="nofollow noreferrer">http://www.rpubs.com/pnice421/347328</a></p>
  
  <p>Under the heading "Generating Bigrams" they provide the following code as a way of achieving this, but I am returning an error:</p>
  
  <pre><code>totalbigrams &lt;- bigrams_filtered2 %&gt;%
      summarize(total=sum(n))
  
  Error in summarise_impl(.data, dots) : 
  Evaluation error: invalid 'type' (closure) of argument.
  </code></pre>
  
  <p>If anyone has any advice on where I might be going wrong it would be greatly appreciated! Thank you.</p>