"RTextTools" create_matrix 出错了

"RTextTools" create_matrix got an error

我是运行RTextTools包构建文本分类模型。

当我准备预测数据集并尝试将其转换为矩阵时。我得到的错误是:

Error in if (attr(weighting, "Acronym") == "tf-idf") weight <- 1e-09 : 
  argument is of length zero

我的代码如下:

table<-read.csv("traintest.csv",header = TRUE)
dtMatrix <- create_matrix(table["COMMENTS"])
container <- create_container(dtMatrix, 
                              table$LIKELIHOOD_TO_RECOMMEND, 
                              trainSize=1:5000,testSize=5001:10000, 
                              virgin=FALSE)
model <- train_model(container, "SVM", kernel="linear", cost=1)

predictionData<-read.csv("rest.csv",header = TRUE)
**predMatrix <- create_matrix(predictionData["COMMENTS"],originalMatrix=dtMatrix)**
Error in if (attr(weighting, "Acronym") == "tf-idf") weight <- 1e-09 : 
      argument is of length zero

最后一个代码给出了错误(粗体) 我尝试搜索 google,但没有找到明确的解决方案。

谢谢

运行 这个:

trace("create_matrix",edit=T)

在弹出的源代码框中,第42行会有"acronym"这个词的拼写错误。将 "A" 更改为 "a" 并点击 "Save" - 之后它应该可以正常工作。