Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ROCR package difficulties

Tags:

r

glm

I'm following an analysis of German Credit data and I got an error which I'm failing to rectify because I already installed the ROCR package. Below is the code that uses the 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)

Now, after running pred, I get the following error:

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

This also happens when I try to execute the following line:

>perf <- performance(pred,"tpr","fpr")
Error: could not find function "performance"
like image 676
user2474671 Avatar asked Oct 22 '22 07:10

user2474671


1 Answers

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

like image 143
Shery Avatar answered Nov 15 '22 21:11

Shery