Errors while creating wordcloud with R

658 views Asked by At

I am using a following CSV file (written in french) :

"1";"Paul is in the kitchen"
"2";"Peter is cooking in the living-room"
"3";"The kitchen is beautiful"

And I want to create a wordcloud with wordcloud2 library.

Here is the R script I wrote :

 data <- read.csv('file.csv', sep="|",quote="",header=TRUE)
 dim(data)
 library(tm)

 documents <- Corpus(VectorSource(data))
 inspect(documents)

 lapply(documents[1],as.character)
 inspect(documents)

 set.seed(1234)

 tdm <- TermDocumentMatrix(documents)
 m <- as.matrix(tdm)
 v <- sort(rowSums(m),decreasing=TRUE)
 d <- data.frame(freq = v)
 d$word=rownames(d)

 library("wordcloud2")
 wordcloud2(d)

But I get the following error :

> wordcloud2(d)
Error in size * 180/max(dataOut$freq) : 
  non-numeric argument to binary operator

What do you think ?

0

There are 0 answers