3
I am a linguist, I work in text mining and I am trying to import a novel (200 pages of text linearly written with line breaks) for analysis in R. Several errors occur.
First I tried:
library(tidytext)
library(dplyr)
library(readr)
estrela <- readLines("estrela.txt")
estrela.tidy <- estrela %>%
unnest_tokens(word, text)
Then I tried:
library(tidytext)
library(dplyr)
library(readr)
estrela <- read_file("estrela.txt")
estrela.tidy <- estrela %>%
unnest_tokens(word, text)
The result I have is in both cases:
Error in UseMethod("unnest_tokens_"): no applicable method for 'unnest_tokens_' applied to an object of class "character"
Am I doing something wrong? Is there any simpler way to import a text to work with tidytext?
Thank you very much!
Thank you very much!
– user135517