Reputation: 63
I am trying to render roc curve using shiny. I tried using both pROC and ROCR packages, and using renderPlot, but the outputplot showing NULL. Is there any way to render ROC Curve in shiny app?
Upvotes: 1
Views: 1019
Reputation: 25395
Don't forget to use plot()
on the ROC object inside the renderPlot
function. Here is a working example:
library(shiny)
library(pROC)
ui <- shinyUI(
plotOutput('myplot')
)
server <- function(input, output)
{
output$myplot <- renderPlot({
my_roc <- pROC::roc(c(1,1,1,1,1,0,0,0,0,0),c(1,1,1,1,0,0,0,0,0,0))
plot(my_roc)
})
}
shinyApp(ui,server)
Hope this helps!
Upvotes: 4