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
121 stars 31 forks source link

Error in CI for sensitivity #97

Closed jakob-wirbel closed 3 years ago

jakob-wirbel commented 3 years ago

Hi all, thanks for the awesome package, first of all 👍
I am using it as a dependency in my own package (SIAMCAT), but I got an error from the pROC package lately.

Description

Recently Bioconductor changed what would be considered an error during package build. The coercion to length 1 when doing a logical comparison has been changed to throw an error, not only a warning (see also here).

This means that when I try to get the confidence interval for the sensitivity of a ROC curve, I get an error generated by the progress bar.

Reproduction

Here is a random-number example:

Sys.setenv(`_R_CHECK_LENGTH_1_CONDITION_`="true")
Sys.setenv(`_R_CHECK_LENGTH_1_LOGIC2_`="true")

library('pROC') #### pROC_1.17.0.1

response <- sample(c(0,1), size = 10, replace = TRUE)
predictor <- rnorm(n=10)
roc(response=response, predictor=predictor, levels=c(0,1), 
    direction='<', ci=TRUE, of='se')

This results in the error:

Error in .progress == "none" && !.inform : 
  'length(x) = 3 > 1' in coercion to 'logical(1)'

I guess it's a problem with the progress bar which is imported through plyr. For now, I have removed the CI option in how my package uses pROC, but it would be amazing to add it back in.

Do you think that there would be a way to fix this behavior easily?

Thank you very much! :)

xrobin commented 3 years ago

Hum... this looks like a bug in plyr actually. Specifically from this line in llply...

According to the documentation one can specify the progress bar either "as name, or you can create the progress bar object yourself if you want more control over its apperance." I'm using the latter but clearly that's not the case here, and one cannot create the progress bar object ourself with those options.

I'm not sure what to do at the moment. Ideally one should fix plyr, but it's unlikely to happen as the project is no longer maintained. Or I could drop the customization of the progress bar...

xrobin commented 3 years ago

An workaround is to check if those environment values are set, and dumb down the progress bar specifically in those cases. Sounds a bit hacky but it should work for now. Can you confirm?

xrobin commented 3 years ago

I opened a PR with plyr. Who knows, maybe it gets fixed.

Meanwhile do you have a way to test the workaround, or should I proceed releasing a new version of pROC with the fix?

jakob-wirbel commented 3 years ago

Hi @xrobin Thanks so much for the fast response! 👍 I checked it on my system and it works with the workaround, but I guess that this is indeed a plyr problem.