0

I am getting problem with an old script using tidytext and dplyr libraries.

My example was extracted from : https://community.rstudio.com/t/problem-with-unnest-tokens-function/94107

But I am having the same problem:

   library(gutenbergr)
   library(dplyr)
   library(tidytext)

    TTLutS_.ted <- gutenberg_download(164, mirror = "http://mirrors.xmission.com/gutenberg/")
    Ulysses_.ted <- gutenberg_download(4300, mirror = "http://mirrors.xmission.com/gutenberg/")
    TTLutS <- tibble(TTLutS_.ted)
    Ulysses <- tibble(Ulysses_.ted)
    TTLutS.words <- TTLutS %>% unnest_tokens(word, text)
    Ulysses.words <- Ulysses %>% unnest_tokens(word, text)
    TTLutS.words %>% count(word, sort = TRUE)

Error: objeto 'txt' no encontrado Run rlang::last_error() to see where the error occurred.

Error in count(., word, sort = TRUE) : unused argument (sort = TRUE)

Rodrigo_BC
  • 161
  • 11

1 Answers1

0

Finally I found a easy solution

   library(gutenbergr)
   library(dplyr)
   library(tidytext)

     TTLutS_.ted <- gutenberg_download(164, mirror = "http://mirrors.xmission.com/gutenberg/")
     Ulysses_.ted <- gutenberg_download(4300, mirror = "http://mirrors.xmission.com/gutenberg/")
     TTLutS <- tibble(TTLutS_.ted)
     Ulysses <- tibble(Ulysses_.ted)
     TTLutS.words <- TTLutS %>% unnest_tokens(word, text)
     Ulysses.words <- Ulysses %>% unnest_tokens(word, text)
     TTLutS.words %>% mutate(n = str_count(word))
Rodrigo_BC
  • 161
  • 11