1

obtaining n-grams following this book on tydy-text: http://tidytextmining.com/ngrams.html

The code:

library(tidyr)

bigrams_separated <- austen_bigrams %>%
  separate(bigram, c("word1", "word2"), sep = " ")

bigrams_filtered <- bigrams_separated %>%
  filter(!word1 %in% stop_words$word) %>%
  filter(!word2 %in% stop_words$word)

# new bigram counts:
bigram_counts <- bigrams_filtered %>% 
  count(word1, word2, sort = TRUE)

I get an error:

Warning: Error in : 'sep' is not an exported object from 'namespace:dplyr'
Forge
  • 1,587
  • 1
  • 15
  • 36
  • I've checked the piece of code from the link along with the one you have pasted and everything works fine. I use: `R version 3.4.1 (2017-06-30)` Have you tried updating packages or `R` env? – storaged Nov 07 '17 at 13:39
  • Yes, updated packages and restarted Rstudio server – Forge Nov 07 '17 at 14:03
  • That is pretty weird; I can't reproduce it unfortunately. You said you are on an instance of RStudio Server. Do you know what versions you are using? – Julia Silge Nov 07 '17 at 21:44

2 Answers2

0

Try this code not loading tidyr:

bigrams_separated <- austen_bigrams %>%
mutate(word1 = sub(" .*", "", bigram),
       word2 = sub(".* ", "", bigram))
useRj
  • 1,232
  • 1
  • 9
  • 15
0

I encountered an identical error, which seems to be solved by specifying tidyr::separate()