pROC Package in R - Run without Call and Data Information in RMarkdown

405 Views Asked by At

Anytime you create a ROC Curve with using pROC::roc() additional Information like the code itself and AUC will be plotted in rmarkdown by default below the plot.

Does anyone know how to print the ROC-Curve without the Call and Data information?

Example

Code

roc(label, score.4ISS,
plot = TRUE,
legacy.axes = TRUE)

Thank you :)

2

There are 2 best solutions below

0
Calimo On

This is because objects are implicitly printed in R when they are not assigned to variables. This means that:

roc(label, score.4ISS, ...)

is equivalent to

print(roc(label, score.4ISS, ...))

which prints call and data information. If you assign the ROC curve to an object, it won't be printed, and you can decide what to print yourself, for instance only the AUC (or nothing at all).

my_roc <- roc(label, score.4ISS, plot = TRUE, legacy.axes = TRUE)
print(auc(my_roc))
0
Oli On

The solution to my problem is to assign roc() to an object. Then it prints ROC without the additional information and without using a additional print() command.

With Information

roc(label, score.4ISS)

Without Information

my_roc <- roc(label, score.4ISS)