1
votes

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?

1

1 Answers

3
votes

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!