Error in '[.simple_triplet_matrix' (myTdm, c (names (termFrequency2 [i])),: Repeated indices currently not allowed

3

I have the following code in R, it worked in version 3.0.2, but in the upper ones it shows the error

  

Error in [.simple_triplet_matrix (myTdm, c (names (termFrequency2 [i])),   : Repeated indices currently not allowed.

myTdm <- TermDocumentMatrix(myCorpus11,control=list(wordLengths=c(3,Inf)))
et3 <- pam(myTdm, 3)
matrix.kmet <- as.matrix(met3$clustering)
termFrequency <- rowSums(as.matrix(matrix.kmet))

#faz um desses p/ cada cluster
termFrequency2 <- subset(termFrequency, termFrequency == 3)

#gero o tamanho da matriz de acordo com o tamanho do cluster
#recupera a frequencia da palavra

a <- matrix(nrow=1, ncol=2)
for(i in names(termFrequency2)) {
    b <- NULL
    z <- inspect( myTdm[c(names(termFrequency2[i])), dimnames(myTdm)$Docs] )

    b <- matrix(c(names(termFrequency2[i]), rowSums(z)), nrow=1, ncol=2)
    a <- rbind(a, b) 
}
    
asked by anonymous 10.07.2016 / 20:54

0 answers