2015-01-23 3 views
0

저는 RTextTools를 처음 사용하고 있습니다. 여기 create_matrix 내 코드Rtexttool create_matrix로 문서 용어 행렬을 만드는 데 문제가 있습니다.

library(RTextTools) 
texts <- c("This is the first document.", 
      "Is this a text?", 
     "This is the second file.", 
     "This is the third text.", 
     "File is not this.") 
doc_matrix <- create_matrix(texts, language="english", removeNumbers=FALSE, stemWords=TRUE, removeSparseTerms=.2) 

나는 다음과 같은 오류 (들)을 얻고있다 :

Error in `[.simple_triplet_matrix`(matrix, , sort(colnames(matrix))) : 
Invalid subscript type: NULL. 
In addition: Warning messages: 
1: In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL' 
2: In is.na(j) : is.na() applied to non-(list or vector) of type 'NULL' 

나는이 오류가 아직 다른 사람 게시물을 보지 못했다, 그리고 그림은 아주 기본적인 뭔가 거기에있는 I를 실종됐다.

피터

답변

1

당신은 removeSparseTermstm 패키지 문서에서 최종 인수 removeSparseTerms=.2)을 제거해야합니다 : "빈의 적어도 스파 스 비율이 X에서 그 용어를 제거하는 용어 - 문서 행렬을 (즉, , 용어는 문서에서 0 번 발생 함) 결과 행렬에는 드문 드문 드문 드문 드문 드문 드문 경우가 있습니다. "

희소성 임계 값이 데이터 세트에 비해 너무 낮습니다.

-1
doc_matrix <- create_matrix(texts, language="english", removeNumbers=FALSE, stemWords=TRUE, removeSparseTerms=.9999) 
관련 문제