문제

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?

도움이 되었습니까?

해결책

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
)

다른 팁

test

nrow(doc_matrix)

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top