5

我正在对德国信用数据进行分析,但由于我已经安装了ROCR软件包,我遇到了一个错误,我无法纠正该错误。下面是使用ROCR的代码:

#load library
library(ROCR)

#score test data set
test$score <- predict(m,type='response',test)
pred <- prediction(test$score,test$good_bad)
perf <- performance(pred,"tpr","fpr")
plot(perf)

现在,运行后pred,我收到以下错误:

>pred <- prediction(test$score,test$Good_Bad)
Error: could not find function "prediction".

当我尝试执行以下行时也会发生这种情况:

>perf <- performance(pred,"tpr","fpr")
Error: could not find function "performance"
4

2 回答 2

3

I had the same issue... If you look closely, it says:

Loading required package: gplots
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘KernSmooth’
In addition: Warning messages:
1: package ‘ROCR’ was built under R version 3.0.3 
2: package ‘gplots’ was built under R version 3.0.3 
Error: package ‘gplots’ could not be loaded

I simply installed the install.packages("gplots") and then loaded the library and it loaded and found the function without any issues.

Hope this helps

于 2014-04-04T10:51:50.540 回答
0

我也有同样的问题,尽管已经安装了“gplots”并且显然是最新的,但我只是通过命令 install.packages("gplots") 重新安装了它,它似乎工作正常。

于 2014-11-13T13:21:39.783 回答