shiny module server for roc analysis
Usage
rocModule(
input,
output,
session,
data,
data_label,
data_varStruct = NULL,
nfactor.limit = 10,
design.survey = NULL,
id.cluster = NULL
)
Arguments
- input
input
- output
output
- session
session
- data
Reactive data
- data_label
Reactuve data label
- data_varStruct
Reactive List of variable structure, Default: NULL
- nfactor.limit
nlevels limit in factor variable, Default: 10
- design.survey
Reactive survey data. default: NULL
- id.cluster
Reactive cluster variable if marginal model, Default: NULL
Examples
library(shiny)
library(DT)
library(data.table)
library(jstable)
library(ggplot2)
library(pROC)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
rocUI("roc")
),
mainPanel(
plotOutput("plot_roc"),
tableOutput("cut_roc"),
ggplotdownUI("roc"),
DTOutput("table_roc")
)
)
)
server <- function(input, output, session) {
data <- reactive(mtcars)
data.label <- reactive(jstable::mk.lev(data1))
out_roc <- callModule(rocModule, "roc",
data = data, data_label = data.label,
data_varStruct = NULL
)
output$plot_roc <- renderPlot({
print(out_roc()$plot)
})
output$cut_roc <- renderTable({
print(out_roc()$cut)
})
output$table_roc <- renderDT({
datatable(out_roc()$tb,
rownames = F, editable = F, extensions = "Buttons",
caption = "ROC results",
options = c(jstable::opt.tbreg("roctable"), list(scrollX = TRUE))
)
})
}