2017-02-17 9 views
0

)에 오류가 발생합니다. 이전 스레드에서 이전에 요청되었지만 해결되지 않았습니다. R 기본 코드 패키지가 새로 설치되었습니다. bigram 또는 trigram 솔루션을 사용할 수 없었습니다. 모두 동일한 오류를 발생 시켰지만 여기에서 시작하겠습니다. 출력과 버전이 포함 된 간단한 예제를 제공합니다.RTextTools의 create_matrix를 사용하면 simple_triplet_matrix (i = i, j = j

library("RTextTools") 
library(tm) 
texts <- c("This is the first document.", "This is the second file.", "This is the third text.") 
corpus <- Corpus(VectorSource(texts)) 
matrix <- create_matrix(texts,ngramLength=3) 

Error in simple_triplet_matrix(i = i, j = j, v = as.numeric(v), nrow = length(allTerms), : 
    'i, j, v' different lengths 
In addition: Warning messages: 
1: In mclapply(unname(content(x)), termFreq, control) : 
    all scheduled cores encountered errors in user code 
2: In simple_triplet_matrix(i = i, j = j, v = as.numeric(v), nrow = length(allTerms), : 
    NAs introduced by coercion 

print(sessionInfo()) 
version 
       _       
platform  x86_64-apple-darwin13.4.0 
arch   x86_64      
os    darwin13.4.0     
system   x86_64, darwin13.4.0   
status          
major   3       
minor   3.2       
year   2016       
month   10       
day   31       
svn rev  71607      
language  R       
version.string R version 3.3.2 (2016-10-31) 
nickname  Sincere Pumpkin Patch  
print(sessionInfo()) 
R version 3.3.2 (2016-10-31) 
Platform: x86_64-apple-darwin13.4.0 (64-bit) 
Running under: macOS Sierra 10.12.3 

locale: 
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

other attached packages: 
[1] RTextTools_1.4.2 SparseM_1.74  tm_0.6-2   NLP_0.1-9  Matrix_1.2-7.1 

loaded via a namespace (and not attached): 
[1] Rcpp_0.12.9   splines_3.3.2  MASS_7.3-45   tau_0.0-18   prodlim_1.5.9  
[6] lattice_0.20-34  foreach_1.4.3  caTools_1.17.1  tools_3.3.2   nnet_7.3-12   
[11] parallel_3.3.2  grid_3.3.2   ipred_0.9-5   glmnet_2.0-5  e1071_1.6-8   
[16] iterators_1.0.8  class_7.3-14  survival_2.39-5  randomForest_4.6-12 lava_1.4.7   
[21] bitops_1.0-6  codetools_0.2-15 maxent_1.3.3.1  rpart_4.1-10  slam_0.1-40   
[26] tree_1.0-37   

답변

0

R 버전 3.3.2에서 3.2.2로 되돌아와 비슷한 문제를 해결했습니다.
DocumentTermMatrix tm 패키지에서 오류가 발생했습니다 :

Error in simple_triplet_matrix(i = i, j = j, v = as.numeric(v), nrow = length(allTerms), : 
    'i, j' invalid 

이 오류는 R 버전 3.2.2를 실행했을 때 발생하지 않았습니다. 3.3.2로 업그레이드 할 때이 오류는 동일한 코드에서 발생했습니다. 아마도 다운 그레이드가 작동 할 것입니다. 죄송합니다.이 오류가 발생하는 이유에 대한 실제 답변을 제공해 드릴 수 없습니다.