R语言 整洁文本内出错,unnest_tokens已弃用

oknrviil  于 2023-06-03  发布在  其他
关注(0)|答案(1)|浏览(184)

unnest_tokens()在tidytext 0.4.0中被弃用,现在已失效
尝试通过R中的twitter数据创建一个2节点图,并收到以下错误消息。

twomode_network <- twitter_data %>% Create("twomode", removeTermsOrHashtags = c("#auspol"), verbose = TRUE)
twomode_graph <- twomode_network %>% Graph()

Generating twitter 2-mode network...
Error:
! `unnest_tokens()` was deprecated in tidytext 0.4.0 and is now defunct.
Run `rlang::last_trace()` to see where the error occurred.
dhxwm5r4

dhxwm5r41#

感谢您的举报!我修复了这个(令人困惑的)消息on GitHub here,现在你可以正确地看到这个:

library(tidytext)

d <- tibble::tibble(
  txt = c("Because I could not stop for Death -", "He kindly stopped for me -"),
  line = 1:2
)

d |> unnest_tweets(word, txt)
#> Error:
#> ! `unnest_tweets()` was deprecated in tidytext 0.4.0 and is now defunct.

创建于2023-06-01使用reprex v2.0.2
和以前一样,当将unnest_tokens()token = "tweets"一起使用时,您将看到以下错误:

library(tidytext)

d <- tibble::tibble(
  txt = c("Because I could not stop for Death -", "He kindly stopped for me -"),
  line = 1:2
)

d |> unnest_tokens(word, txt, token = "tweets")
#> Error:
#> ! Support for `token = "tweets"` was deprecated in tidytext 0.4.0 and is
#>   now defunct.

创建于2023-06-01使用reprex v2.0.2
由于上游依赖关系的变化,tweet特定的标记器被移除;你可以在这里的文档中看到它。

相关问题