sachsmc / plotROC

Interactive ROC plots with ggplot + d3.js.
http://sachsmc.github.io/plotROC
Other
86 stars 15 forks source link

Make it work with single class or empty groups #85

Open pslacerda opened 3 weeks ago

pslacerda commented 3 weeks ago

When there is a single class on data or the group is empty, verify_d fails with an error (not an explicit error but a logic one) because it cannot guess the binary classes. But the desired behavior is to produce an empty plot.

Error in `geom_roc()`: Problem while computing stat.
ℹ Error occurred in the 1st layer.
Caused by error in `if (slev[1] == 0 & slev[2] == 1) ...`:
! missing value where TRUE/FALSE needed

This was a problem for me when attempting to calc_auc(p) on an empty group and didn't received NA as expected.

pslacerda commented 3 weeks ago

I did this PR on top of #84.