使用RTEXTOOLS中的create_矩阵会在简单_三元组_矩阵(i=i,j=j)中产生错误

使用RTEXTOOLS中的create_矩阵会在简单_三元组_矩阵(i=i,j=j)中产生错误,r,text,mining,R,Text,Mining,以前有人问过这个问题,但在一个旧的线程中从未解决过。人们在这个线程的底部遇到了这个问题-R基本代码和包是新安装的。我无法让任何bigram或trigram解决方案工作-它们都产生了相同的错误,但我想我应该从这里开始。 我将给出一个输出和版本的简单示例 library("RTextTools") library(tm) texts <- c("This is the first document.", "This is the second file.", "This is the thir

以前有人问过这个问题,但在一个旧的线程中从未解决过。人们在这个线程的底部遇到了这个问题-R基本代码和包是新安装的。我无法让任何bigram或trigram解决方案工作-它们都产生了相同的错误,但我想我应该从这里开始。 我将给出一个输出和版本的简单示例

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        
库(“RTextTools”)
图书馆(tm)

textI通过从R版本3.3.2恢复到3.2.2,解决了类似的问题
我的情况略有不同,因为我在tm软件包中使用DocumentTermMatrix,并收到一个错误:

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时,此错误发生在同一段代码上。降级可能会起作用。很抱歉,我无法提供此错误发生原因的实际答案