Hi all,

I am trying to do some text mining with twitter and I am getting the error:

Error in structure(names(sapply(possibleCompletions, "[", 1)), names = x) :
  'names' attribute [1] must be the same length as the vector [0]


When I use tm_map. Has anyone had/seen this error before? The code I
have is shown below and this error only occurs with #qantas, hashtags
like #asx, #obama work ok.


Appreciate any help.

Thanks,

Sachin


library(twitteR)
library(tm)
library(wordcloud)


hashTag<-function (hashTag, minFreq){

tweets<- searchTwitter(hashTag, n=200)
df <- do.call("rbind", lapply(tweets, as.data.frame))

myCorpus <- Corpus(VectorSource(df$text))
myCorpus <- tm_map(myCorpus, function(x) iconv(enc2utf8(x), sub = "byte"))
myCorpus <- tm_map(myCorpus, tolower)
myCorpus <- tm_map(myCorpus, removePunctuation)
myCorpus <- tm_map(myCorpus, removeNumbers)
myStopwords <- c(stopwords('english'), "available", "via")
myCorpus <- tm_map(myCorpus, removeWords, myStopwords)

dictCorpus <- myCorpus
myCorpus <- tm_map(myCorpus, stemDocument)

################ERROR HAPPENS ON NEXT LINE##################################
myCorpus <- tm_map(myCorpus, stemCompletion, dictionary=dictCorpus)
myDtm <- TermDocumentMatrix(myCorpus, control = list(minWordLength = 1))

m <- as.matrix(myDtm)
v <- sort(rowSums(m), decreasing=TRUE)
myNames <- names(v)
d <- data.frame(word=myNames, freq=v)
wordcloud(d$word, d$freq, min.freq=minFreq)
list(freq=v, TextMatrix=myDtm)
}


qantas=hashTag("#qantas", 7)

	[[alternative HTML version deleted]]

