使用R

时间:2018-03-24 08:00:57

标签: r random-forest

您好我是R的新手,想在R中执行短信分类。数据包含2列:“类型”:垃圾邮件或火腿和“邮件”:字符。我已执行数据清理并将数据转换为文档术语矩阵

data_dtm <- DocumentTermMatrix(corpus, control = list(global = c(2, Inf))) 现在我想使用随机森林分类:

sms_classifier <- randomForest(x= as.matrix(sms_dtm_train), y= train_data$type, ntree= 10)

sms_dtm_train:是训练数据的文档术语矩阵 此代码无效。请告诉我有什么问题? 这是我得到的错误消息

Error in randomForest.default(x = as.matrix(sms_dtm_train), y = train_data$type, : NA/NaN/Inf in foreign function call (arg 1) In addition: Warning message: In storage.mode(x) <- "double" : NAs introduced by coercion

0 个答案:

没有答案
相关问题