Ошибка в strwidth (слова [i], cex = size [i], ...): недопустимое значение 'cex' - не могу найти решение - PullRequest
1 голос
/ 10 мая 2019
library("tm")
library("twitteR")
library("wordcloud")

clean.text <- function(x, lowercase=TRUE, numbers=TRUE, punctuation=TRUE, spaces=TRUE)
{
  # x: character string

  # lower case
  if (lowercase)
x = tolower(x)
  # remove numbers
  if (numbers)
x = gsub("[[:digit:]]", "", x)
  # remove punctuation symbols
if (punctuation)
   x = gsub("[[:punct:]]", "", x)
   # remove extra white spaces
if (spaces) {
x = gsub("[ \t]{2,}", " ", x)
x = gsub("^\\s+|\\s+$", "", x)
}
   # return
  x
}

teste_word_cloud$text <- as.factor(teste_word_cloud$text)
ensaio1 = clean.text(teste_word_cloud$text)
teste_word_cloud2$text <- as.factor(teste_word_cloud2$text)
ensaio2 = clean.text(teste_word_cloud2$text)
teste_word_cloud3$text <- as.factor(teste_word_cloud3text)
ensaio3 = clean.text(teste_word_cloud3$text)
teste_word_cloud4$text <- as.factor(teste_word_cloud4text)
ensaio4 = clean.text(teste_word_cloud4$text)

e1 = paste(ensaio1, collapse=" ")
e2 = paste(ensaio2, collapse=" ")
e3 = paste(ensaio3, collapse=" ")
e4 = paste(ensaio4, collapse=" ")
all = c(e1,e2,e3,e4)

corpus = Corpus(VectorSource(all))
tdm = TermDocumentMatrix(corpus)

tdm = as.matrix(tdm)


colnames(tdm) = c("Ensaio 1", "Ensaio 2", "Ensaio 3", "Ensaio 4")

comparison.cloud(tdm, random.order=FALSE,
             colors = c("#00B2FF", "red"),
             title.size = 1.5, max.words = 500)

Я хочу выполнить сравнение wordcloud, но возникает эта ошибка: Ошибка в strwidth (words [i], cex = size [i], ...): недопустимое значение 'cex'.Я думаю, из того, что я прочитал, что это из-за АН, но я не могу найти решение.Спасибо за любую помощь.

...