'sep' 不是 'namespace:dplyr' 的导出对象

'sep' is not an exported object from 'namespace:dplyr'

按照 tydy-text 上的这本书获得 n-grams:http://tidytextmining.com/ngrams.html

代码:

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)

我收到一个错误:

Warning: Error in : 'sep' is not an exported object from 'namespace:dplyr'

试试这个不加载 tidyr 的代码:

bigrams_separated <- austen_bigrams %>%
mutate(word1 = sub(" .*", "", bigram),
       word2 = sub(".* ", "", bigram))

我遇到了一个相同的错误,似乎可以通过指定 tidyr::separate()

来解决