Tokenizing text file generates error using word tokenize words

0 votes

library(tokenizers)
library(SnowballC)

my_data <- read.delim("Shakespeare.txt")

tokenize_words(my_data$ACT.I

I am trying to run this code but getting the following error 

 Error in check_input(x) : 
  Input must be a character vector of any length or a list of character
  vectors, each of which has a length of 1.

Can you help me with this, please?

Aug 28, 2018 in Data Analytics by Anmol
• 1,780 points
2,657 views

1 answer to this question.

0 votes

Hi Bolder,

As you are using the delim function to read the file it would generate factors which cant be used as an input to the tokenizer.

Try 

text_df<-tokenize_words(as.character(my_data))

Hope this helps

answered Aug 28, 2018 by Abhi
• 3,720 points

Related Questions In Data Analytics

0 votes
1 answer

Read text file and save as csv file using R

hi, Read the text file and save it ...READ MORE

answered Sep 30, 2019 in Data Analytics by Cherukuri
• 33,030 points
742 views
0 votes
3 answers

How to write lines to a text file in R?

sink("outfile.txt") cat("hello") cat("\n" ...READ MORE

answered May 24, 2019 in Data Analytics by anonymous
19,076 views
0 votes
1 answer

How to prevent row names to be written to a file while using

Easily by: write.csv(df, "temp.csv", row.names=FALSE) READ MORE

answered Apr 20, 2018 in Data Analytics by DeepCoder786
• 1,720 points
728 views
0 votes
1 answer

How to import text file as a single character string?

First way: rd<-readChar("temp.txt",file.info("temp.txt")$size) ...READ MORE

answered Apr 23, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,312 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,224 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
5,909 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,157 views
0 votes
1 answer

Plotting multiple graphs on the same page in R

If you want to plot 4 graphs ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,441 views
0 votes
1 answer

How can I perform word stemming in R

The tm package in R provides the stemDocument() function to stem the ...READ MORE

answered Aug 20, 2018 in Data Analytics by Abhi
• 3,720 points
4,576 views
0 votes
1 answer

Python or R – Which one would you prefer for text analytics?

We will prefer Python because of the ...READ MORE

answered Aug 20, 2018 in Data Analytics by Abhi
• 3,720 points
4,600 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP