Pregunta

I am using create_container in RTextTools package in R, but getting the error:

container <- create_container(doc_matrix, rawTags, trainSize=1:0.8*nrow(tagsSub),
                              testSize=0.8*nrow(tagsSub)+1:nrow(tagsSub),
                              virgin=FALSE)

# Error in [.simple_triplet_matrix(matrix, totalSize, ) : subscript out of bounds !

Can anyone suggest what is going wrong?

¿Fue útil?

Solución

It appears that you might not be specifying the sizes correctly. The : operator has a very high priority. You might try

container <- create_container(doc_matrix, rawTags, 
    trainSize=1:(0.8*nrow(tagsSub)), 
    testSize=(0.8*nrow(tagsSub)+1):nrow(tagsSub), 
    virgin=FALSE
)

Otros consejos

test

nrow(doc_matrix)

that count is maximum you apply after colon (:).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top