Question

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?

Was it helpful?

Solution

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
)

OTHER TIPS

test

nrow(doc_matrix)

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top