【问题标题】:'sep' is not an exported object from 'namespace:dplyr''sep' 不是从 'namespace:dplyr' 导出的对象
【发布时间】:2017-11-07 12:43:07
【问题描述】:

在tydy-text这本书之后获得n-gram: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'

【问题讨论】:

  • 我已经检查了链接中的一段代码以及您粘贴的代码,一切正常。我用:R version 3.4.1 (2017-06-30)你试过更新包还是Renv?
  • 是的,更新了软件包并重启了 Rstudio 服务器
  • 这很奇怪;不幸的是,我无法重现它。你说你在 RStudio Server 的一个实例上。你知道你用的是什么版本吗?

标签: r dplyr tidyr tidytext


【解决方案1】:

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

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

【讨论】:

  • 这没有帮助。
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2018-03-31
    • 2022-08-12
    • 2022-01-07
    • 2021-02-01
    • 1970-01-01
    • 2021-03-31
    • 1970-01-01
    • 1970-01-01
    • 2019-06-16
    相关资源
    最近更新 更多