I have a data frame that returns two column variables - word1 and word2 like this:
head(bigrams_filtered2, 20)
# A tibble: 20 x 2
word1 word2
<chr> <chr>
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
I am trying to add two additional column variables to this data.frame so that my output looks like this:
## 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
I'm following an example from here http://www.rpubs.com/pnice421/347328
Under the heading "Generating Bigrams" they provide the following code as a way of achieving this, but I am returning an error:
totalbigrams <- bigrams_filtered2 %>%
summarize(total=sum(n))
Error in summarise_impl(.data, dots) :
Evaluation error: invalid 'type' (closure) of argument.
If anyone has any advice on where I might be going wrong it would be greatly appreciated! Thank you.