xrobin / pROC

Display and analyze ROC curves in R and S+
https://cran.r-project.org/web/packages/pROC/
GNU General Public License v3.0
118 stars 31 forks source link

pROC issues #62

Closed binahmerd closed 4 years ago

binahmerd commented 4 years ago

I am very new to R and I am having an issue when trying to load the Library pROC, an error message keep up displaying. Please i need a solution on how to make this work, I attached the code snippet of my work, Thank you

library(pROC) #For area under the receive operation characteristics (ROC) curve Type 'citation("pROC")' for a citation.

Attaching package: ‘pROC’

The following objects are masked from ‘package:stats’:

cov, smooth, var

library(pROC) #For area under the receive operation characteristics (ROC) curve ccfd.testc$Class <- ordered(ccfd.testc$Class, levels=c("0", "1")) ccfd.testc$Pres <- ordered(ccfd.testc$Pred, levels=c("0", "1")) auc(ccfd.testc$Class, ccfd.testc$Pred) Setting levels: control = 0, case = 1 Error in roc.default(response, predictor, auc = TRUE, ...) : Predictor must be numeric or ordered. auc(ccfd.testc$Class, ccfd.testc$Pred) Setting levels: control = 0, case = 1 Error in roc.default(response, predictor, auc = TRUE, ...) : Predictor must be numeric or ordered.

Screenshot 2019-09-22 at 02 04 06
xrobin commented 4 years ago

This is working for me.

library(pROC)
data(aSAH)
aSAH$outcome <- ordered(aSAH$outcome)
aSAH$wfns <- ordered(aSAH$wfns)
auc(aSAH$outcome, aSAH$wfns)
Setting levels: control = Good, case = Poor
Setting direction: controls < cases
Area under the curve: 0.8237

Please include a minimal working example to reproduce this problem. In addition you omitted several important information that were requested when you opened the issue such as sessionInfo etc. These are potentially important to reproduce the issue. Please go back to the bug report form and add this information as well.

xrobin commented 4 years ago

I am closing this issue for now as it lacks essential information to reproduce it. Feel free to re-open and provide a reproducible example.