我正在对德国信贷数据进行分析,但由于我已经安装了 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"
最佳答案
我遇到了同样的问题...如果您仔细观察,它会说:
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
我只是简单地安装了install.packages(“gplots”),然后加载了库,然后它加载并找到了没有任何问题的函数。
希望这可以帮助
关于r - 使用ROCR套件的困难,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17045915/