简体   繁体   中英

Error message in R: Error in mutate_impl(.data, dots) : invalid argument type

I tried to use tidytext to analyze some text and use the code below; however got an error message:

dt %>% unnest_tokens(output, input, token="ngrams", n=3)
 Error in mutate_impl(.data, dots) : invalid argument type 

This is the error message I got on my company's internal R platform, however the code runs on my local R studio. What should I do to correct the error? (both input and output are strings)

I had what appeared to be the same issue as the OP described here. The following code generated the same error, which is straight out of the package documentation.

library(janeaustenr)

austen_bigrams <- austen_books() %>% unnest_tokens(bigram, text, token = "ngrams", n = 2)

Using old.packages() I saw that my dplyr and tidyr were outdated, so I updated them with install.packages() and now the error is gone. Evidently the package version was the issue.

I had the same error and updated my dplyr and tidytext packages which caused the error to go away. (I tried to add this as a comment to Jason's answer, but don't yet have enough reputation).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM