| Title: | 'RStudio' Addins and 'Shiny' Modules for Medical Research |
|---|---|
| Description: | 'RStudio' addins and 'Shiny' modules for descriptive statistics, regression and survival analysis. |
| Authors: | Jinseob Kim [aut, cre] (ORCID: <https://orcid.org/0000-0002-9403-605X>), Zarathu [cph, fnd], Hyunki Lee [aut], Changwoo Lim [aut], Jinhwan Kim [aut] (ORCID: <https://orcid.org/0009-0009-3217-2417>), Yoonkyoung Jeon [aut], Jaewoong Heo [aut], Youngsun Park [aut] (ORCID: <https://orcid.org/0009-0009-9336-2281>), Hyungwoo Jo [aut], Jeongmin Seo [aut], Hojun LEE [aut], Sungho Choi [aut], Yeji Kang [aut], Mingu Jee [aut] |
| Maintainer: | Jinseob Kim <[email protected]> |
| License: | Apache License 2.0 |
| Version: | 2.0.1 |
| Built: | 2026-05-27 15:14:25 UTC |
| Source: | https://github.com/jinseob2kim/jsmodule |
AI-powered statistical analysis assistant module server
aiAssistant( input, output, session, data, data_label, data_varStruct = NULL, api_key = NULL, stats_guide = NULL, show_api_config = TRUE, analysis_context = NULL )aiAssistant( input, output, session, data, data_label, data_varStruct = NULL, api_key = NULL, stats_guide = NULL, show_api_config = TRUE, analysis_context = NULL )
input |
input |
output |
output |
session |
session |
data |
Data (reactive). Should return the current data set each time it is called. |
data_label |
Data label (reactive). Typically created with 'jstable::mk.lev()'. |
data_varStruct |
Variable structure list of data (reactive or NULL). If NULL, automatically generates 'list(variable = names(data()))'. Can also be a reactive returning a named list with elements like 'Base', 'Event', 'Time', etc. Default: NULL |
api_key |
API key for AI service. If NULL, reads from provider-specific environment variables ('ANTHROPIC_API_KEY', 'OPENAI_API_KEY', 'GOOGLE_API_KEY') configured in '.Renviron' file |
stats_guide |
Optional custom statistical guide text to override default guidelines. Can be a character string or reactive. If NULL, uses built-in statistical best practices guide. Useful for adding domain-specific statistical conventions or organizational standards. |
show_api_config |
If TRUE, shows API config UI. If FALSE, uses only env vars. Default: TRUE |
analysis_context |
Optional character string, list, or reactive returning that information. Used to pass prior analysis context that the AI can reference in follow-up questions. |
'data' and 'data_label' must be reactives; their values are re-evaluated every time the module needs data.
'data_varStruct' can be NULL (auto-generated) or a reactive returning a named list with elements like 'variable', 'Base', 'Event', 'Time', etc. This mirrors the structure used by other *jsmodule* components.
Generated code runs in a sandbox that only exposes the supplied data and allows the following packages: jstable, jskm, jsmodule, survival, ggplot2, ggpubr, pROC, data.table, DT, gridExtra, GGally, forestploter, MatchIt, timeROC.
API keys are resolved in the order: explicit 'api_key' argument, UI input (if 'show_api_config = TRUE'), provider-specific environment variables ('ANTHROPIC_API_KEY', 'OPENAI_API_KEY', 'GOOGLE_API_KEY').
To use environment variables for API keys, add them to your '.Renviron' file (use 'usethis::edit_r_environ()' to open it) with lines like:
'ANTHROPIC_API_KEY=your_key_here'
'OPENAI_API_KEY=your_key_here'
'GOOGLE_API_KEY=your_key_here'
Then restart R session for changes to take effect.
'analysis_context' can be a static string/list or a reactive that returns a description of prior analyses (tables, plots, code snippets). The text is appended to the system prompt so the AI can reference earlier steps.
Server module (no explicit return value). Creates reactive outputs and observers for chat conversation history, generated code execution, analysis results (tables, plots, text), and export functionality.
## Not run: # Setup: Add API key to .Renviron file # usethis::edit_r_environ() # Add line: ANTHROPIC_API_KEY=your_actual_key_here # Save and restart R library(shiny) library(DT) library(survival) # Example 1: Basic usage with auto-generated variable structure ui <- fluidPage( titlePanel("AI Statistical Assistant"), aiAssistantUI("ai") ) server <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = NULL # Auto-generates variable structure ) } shinyApp(ui, server) # Example 2: With custom variable structure and analysis context ui2 <- fluidPage( titlePanel("Survival Analysis Assistant"), aiAssistantUI("ai") ) server2 <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) # Custom variable structure for survival analysis var_struct <- reactive({ list( variable = names(colon), Base = c("rx", "sex", "age", "obstruct", "nodes"), Event = "status", Time = "time" ) }) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = var_struct, analysis_context = reactive({ "Colon cancer adjuvant chemotherapy trial (survival::colon). Primary outcome: time to recurrence or death (status/time). Treatment groups: Observation, Levamisole, Levamisole+5-FU." }) ) } shinyApp(ui2, server2) # Example 3: Production deployment without API config UI ui_prod <- fluidPage( aiAssistantUI("ai", show_api_config = FALSE) ) server_prod <- function(input, output, session) { # Relies entirely on .Renviron configuration callModule(aiAssistant, "ai", data = reactive(mtcars), data_label = reactive(jstable::mk.lev(mtcars)), show_api_config = FALSE ) } shinyApp(ui_prod, server_prod) ## End(Not run)## Not run: # Setup: Add API key to .Renviron file # usethis::edit_r_environ() # Add line: ANTHROPIC_API_KEY=your_actual_key_here # Save and restart R library(shiny) library(DT) library(survival) # Example 1: Basic usage with auto-generated variable structure ui <- fluidPage( titlePanel("AI Statistical Assistant"), aiAssistantUI("ai") ) server <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = NULL # Auto-generates variable structure ) } shinyApp(ui, server) # Example 2: With custom variable structure and analysis context ui2 <- fluidPage( titlePanel("Survival Analysis Assistant"), aiAssistantUI("ai") ) server2 <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) # Custom variable structure for survival analysis var_struct <- reactive({ list( variable = names(colon), Base = c("rx", "sex", "age", "obstruct", "nodes"), Event = "status", Time = "time" ) }) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = var_struct, analysis_context = reactive({ "Colon cancer adjuvant chemotherapy trial (survival::colon). Primary outcome: time to recurrence or death (status/time). Treatment groups: Observation, Levamisole, Levamisole+5-FU." }) ) } shinyApp(ui2, server2) # Example 3: Production deployment without API config UI ui_prod <- fluidPage( aiAssistantUI("ai", show_api_config = FALSE) ) server_prod <- function(input, output, session) { # Relies entirely on .Renviron configuration callModule(aiAssistant, "ai", data = reactive(mtcars), data_label = reactive(jstable::mk.lev(mtcars)), show_api_config = FALSE ) } shinyApp(ui_prod, server_prod) ## End(Not run)
AI-powered statistical analysis assistant module UI
aiAssistantUI(id, show_api_config = TRUE)aiAssistantUI(id, show_api_config = TRUE)
id |
Module's namespace ID. Used to create unique identifiers for UI elements. |
show_api_config |
If TRUE, shows API configuration UI. If FALSE, uses only env vars. Default: TRUE |
Provides an interactive chat interface with AI for statistical analysis code generation
Shiny UI tagList containing the AI Assistant interface with chat, code editor, and result panels
## Not run: # Setup: Add API key to .Renviron file # usethis::edit_r_environ() # Add line: ANTHROPIC_API_KEY=your_actual_key_here # Save and restart R library(shiny) library(DT) library(survival) # Example 1: Basic usage with auto-generated variable structure ui <- fluidPage( titlePanel("AI Statistical Assistant"), aiAssistantUI("ai") ) server <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = NULL # Auto-generates variable structure ) } shinyApp(ui, server) # Example 2: With custom variable structure and analysis context ui2 <- fluidPage( titlePanel("Survival Analysis Assistant"), aiAssistantUI("ai") ) server2 <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) # Custom variable structure for survival analysis var_struct <- reactive({ list( variable = names(colon), Base = c("rx", "sex", "age", "obstruct", "nodes"), Event = "status", Time = "time" ) }) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = var_struct, analysis_context = reactive({ "Colon cancer adjuvant chemotherapy trial (survival::colon). Primary outcome: time to recurrence or death (status/time). Treatment groups: Observation, Levamisole, Levamisole+5-FU." }) ) } shinyApp(ui2, server2) # Example 3: Production deployment without API config UI ui_prod <- fluidPage( aiAssistantUI("ai", show_api_config = FALSE) ) server_prod <- function(input, output, session) { # Relies entirely on .Renviron configuration callModule(aiAssistant, "ai", data = reactive(mtcars), data_label = reactive(jstable::mk.lev(mtcars)), show_api_config = FALSE ) } shinyApp(ui_prod, server_prod) ## End(Not run)## Not run: # Setup: Add API key to .Renviron file # usethis::edit_r_environ() # Add line: ANTHROPIC_API_KEY=your_actual_key_here # Save and restart R library(shiny) library(DT) library(survival) # Example 1: Basic usage with auto-generated variable structure ui <- fluidPage( titlePanel("AI Statistical Assistant"), aiAssistantUI("ai") ) server <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = NULL # Auto-generates variable structure ) } shinyApp(ui, server) # Example 2: With custom variable structure and analysis context ui2 <- fluidPage( titlePanel("Survival Analysis Assistant"), aiAssistantUI("ai") ) server2 <- function(input, output, session) { data <- reactive(colon) data.label <- reactive(jstable::mk.lev(colon)) # Custom variable structure for survival analysis var_struct <- reactive({ list( variable = names(colon), Base = c("rx", "sex", "age", "obstruct", "nodes"), Event = "status", Time = "time" ) }) callModule(aiAssistant, "ai", data = data, data_label = data.label, data_varStruct = var_struct, analysis_context = reactive({ "Colon cancer adjuvant chemotherapy trial (survival::colon). Primary outcome: time to recurrence or death (status/time). Treatment groups: Observation, Levamisole, Levamisole+5-FU." }) ) } shinyApp(ui2, server2) # Example 3: Production deployment without API config UI ui_prod <- fluidPage( aiAssistantUI("ai", show_api_config = FALSE) ) server_prod <- function(input, output, session) { # Relies entirely on .Renviron configuration callModule(aiAssistant, "ai", data = reactive(mtcars), data_label = reactive(jstable::mk.lev(mtcars)), show_api_config = FALSE ) } shinyApp(ui_prod, server_prod) ## End(Not run)
Shiny module server for barplot.
barServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)barServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)
id |
id |
data |
Reactive data |
data_label |
Reactive data label |
data_varStruct |
Reactive List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
Shiny module server for barplot.
Shiny module server for barplot.
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( barUI("bar") ), mainPanel( optionUI("bar"), plotOutput("bar_plot"), ggplotdownUI("bar") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_bar <- barServer("bar", data = data, data_label = data.label, data_varStruct = NULL ) output$bar_plot <- renderPlot({ print(out_bar()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( barUI("bar") ), mainPanel( optionUI("bar"), plotOutput("bar_plot"), ggplotdownUI("bar") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_bar <- barServer("bar", data = data, data_label = data.label, data_varStruct = NULL ) output$bar_plot <- renderPlot({ print(out_bar()) }) }
Shiny module UI for barplot
barUI(id, label = "barplot")barUI(id, label = "barplot")
id |
id |
label |
label |
Shiny module UI for barplot
Shiny module UI for barplot
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( barUI("bar") ), mainPanel( optionUI("bar"), plotOutput("bar_plot"), ggplotdownUI("bar") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_bar <- barServer("bar", data = data, data_label = data.label, data_varStruct = NULL ) output$bar_plot <- renderPlot({ print(out_bar()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( barUI("bar") ), mainPanel( optionUI("bar"), plotOutput("bar_plot"), ggplotdownUI("bar") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_bar <- barServer("bar", data = data, data_label = data.label, data_varStruct = NULL ) output$bar_plot <- renderPlot({ print(out_bar()) }) }
Shiny module server for boxplot.
boxServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)boxServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)
id |
id |
data |
Reactive data |
data_label |
Reactive data label |
data_varStruct |
Reactive List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
Shiny module server for boxplot.
Shiny module server for boxplot.
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( boxUI("box") ), mainPanel( optionUI("box"), plotOutput("box_plot"), ggplotdownUI("box") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_box <- boxServer("box", data = data, data_label = data.label, data_varStruct = NULL ) output$box_plot <- renderPlot({ print(out_box()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( boxUI("box") ), mainPanel( optionUI("box"), plotOutput("box_plot"), ggplotdownUI("box") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_box <- boxServer("box", data = data, data_label = data.label, data_varStruct = NULL ) output$box_plot <- renderPlot({ print(out_box()) }) }
Shiny module UI for boxplot
boxUI(id, label = "boxplot")boxUI(id, label = "boxplot")
id |
id |
label |
label |
Shiny module UI for boxplot
Shiny module UI for boxplot
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( boxUI("box") ), mainPanel( optionUI("box"), plotOutput("box_plot"), ggplotdownUI("box") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_box <- boxServer("box", data = data, data_label = data.label, data_varStruct = NULL ) output$box_plot <- renderPlot({ print(out_box()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( boxUI("box") ), mainPanel( optionUI("box"), plotOutput("box_plot"), ggplotdownUI("box") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_box <- boxServer("box", data = data, data_label = data.label, data_varStruct = NULL ) output$box_plot <- renderPlot({ print(out_box()) }) }
Shiny modulde server for Cox's model.
coxModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 20, id.cluster = NULL, ties.coxph = "efron", vec.event = NULL, vec.time = NULL )coxModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 20, id.cluster = NULL, ties.coxph = "efron", vec.event = NULL, vec.time = NULL )
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 |
default.unires |
Set default independent variables using univariate analysis. |
limit.unires |
Change to default.unires = F if number of independent variables > limit.unires, Default: 20 |
id.cluster |
reactive cluster variable if marginal cox model, Default: NULL |
ties.coxph |
'coxph' ties option, one of 'efron', 'breslow', 'exact', default: 'erfon' |
vec.event |
event variables as vector for survival analysis, Default: NULL |
vec.time |
time variables as vector for survival analysis, Default: NULL |
Shiny modulde server for Cox's model.
Shiny modulde server for Cox's model.
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( coxUI("cox") ), mainPanel( DTOutput("coxtable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_cox <- callModule(coxModule, "cox", data = data, data_label = data.label, data_varStruct = NULL ) output$coxtable <- renderDT({ datatable(out_cox()$table, rownames = T, caption = out_cox()$caption) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( coxUI("cox") ), mainPanel( DTOutput("coxtable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_cox <- callModule(coxModule, "cox", data = data, data_label = data.label, data_varStruct = NULL ) output$coxtable <- renderDT({ datatable(out_cox()$table, rownames = T, caption = out_cox()$caption) }) }
Shiny modulde UI for Cox's model.
coxUI(id)coxUI(id)
id |
id |
Shiny modulde UI for Cox's model.
coxUI
coxUI(1)coxUI(1)
The server-side logic for the 'csvFileInput' module. It uses the 'DataManager' R6 class to handle all data processing.
csvFile(input, output, session, nfactor.limit = 20)csvFile(input, output, session, nfactor.limit = 20)
input, output, session
|
Standard Shiny server parameters. |
nfactor.limit |
An integer, the threshold for unique values to suggest a numeric variable as categorical, Default: 20 |
A reactive expression that returns a list with two elements: 'data' (the processed data.table) and 'label' (a data.table with variable label information).
Shiny module UI for file upload supporting csv, xlsx, sav, sas7bdat, and dta formats. It provides UI outputs for various data manipulation options.
csvFileInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")csvFileInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
id |
A string, the module id. |
label |
A string, the label for the file input, Default: 'Upload data (csv/xlsx/sav/sas7bdat/dta)' |
This function only defines the UI. The corresponding server function, 'csvFile', handles the logic.
A Shiny UI object.
if (interactive()) { library(shiny) library(DT) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( csvFileInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { data_info <- callModule(csvFile, "datafile") output$data <- renderDT({ data_info()$data }) output$label <- renderDT({ data_info()$label }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(DT) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( csvFileInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { data_info <- callModule(csvFile, "datafile") output$data <- renderDT({ data_info()$data }) output$label <- renderDT({ data_info()$label }) } shinyApp(ui, server) }
Server-side logic for propensity score analysis. It uses 'DataManager' for common data tasks and adds specific controls and calculations for propensity score matching.
FilePs(input, output, session, nfactor.limit = 20)FilePs(input, output, session, nfactor.limit = 20)
input, output, session
|
Standard Shiny server parameters. |
nfactor.limit |
An integer, the threshold for unique values. |
A reactive expression returning a list with matched data and other information.
Provides a file input and UI outputs for options related to propensity score matching.
FilePsInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")FilePsInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
id |
A string, the module id. |
label |
A string, the label for the file input. |
A Shiny UI object.
if (interactive()) { library(shiny) library(DT) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Matching data", DTOutput("matdata")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { mat_info <- callModule(FilePs, "datafile") output$data <- renderDT({ mat_info()$data }) output$matdata <- renderDT({ mat_info()$matdata }) output$data_label <- renderDT({ mat_info()$label }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(DT) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Matching data", DTOutput("matdata")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { mat_info <- callModule(FilePs, "datafile") output$data <- renderDT({ mat_info()$data }) output$matdata <- renderDT({ mat_info()$matdata }) output$data_label <- renderDT({ mat_info()$label }) } shinyApp(ui, server) }
Server module for repeated measures analysis. It uses 'DataManager' and adds a control for selecting the repeated measures variable.
FileRepeated(input, output, session, nfactor.limit = 20)FileRepeated(input, output, session, nfactor.limit = 20)
input, output, session
|
Standard Shiny server parameters. |
nfactor.limit |
An integer, the threshold for unique values. |
A reactive list with the processed 'data', 'label', and 'id.gee'.
File upload UI for repeated measure analysis.
FileRepeatedInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")FileRepeatedInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
id |
A string, the module id. |
label |
A string, the label for the file input. |
A Shiny UI object.
if (interactive()) { library(shiny) library(DT) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel(FileRepeatedInput("datafile")), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { data_info <- callModule(FileRepeated, "datafile") output$data <- renderDT({ data_info()$data }) output$label <- renderDT({ data_info()$label }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(DT) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel(FileRepeatedInput("datafile")), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { data_info <- callModule(FileRepeated, "datafile") output$data <- renderDT({ data_info()$data }) output$label <- renderDT({ data_info()$label }) } shinyApp(ui, server) }
Server module for survey data analysis. It uses 'DataManager' and adds controls and logic for creating a 'survey.design' object.
FileSurvey(input, output, session, nfactor.limit = 20)FileSurvey(input, output, session, nfactor.limit = 20)
input, output, session
|
Standard Shiny server parameters. |
nfactor.limit |
An integer, the threshold for unique values. |
A reactive list with 'data', 'label', 'naomit', and the 'survey' object.
File upload UI for survey data analysis, with controls for survey design elements.
FileSurveyInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")FileSurveyInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
id |
A string, the module id. |
label |
A string, the label for the file input. |
A Shiny UI object.
if (interactive()) { library(shiny) library(DT) library(jstable) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel(FileSurveyInput("datafile")), mainPanel( h4("Survey object details:"), verbatimTextOutput("survey_summary"), tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { data_info <- callModule(FileSurvey, "datafile") output$data <- renderDT({ data_info()$data }) output$label <- renderDT({ data_info()$label }) output$survey_summary <- renderPrint({ print(data_info()$survey) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) library(DT) library(jstable) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel(FileSurveyInput("datafile")), mainPanel( h4("Survey object details:"), verbatimTextOutput("survey_summary"), tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label")) ) ) ) ) server <- function(input, output, session) { data_info <- callModule(FileSurvey, "datafile") output$data <- renderDT({ data_info()$data }) output$label <- renderDT({ data_info()$label }) output$survey_summary <- renderPrint({ print(data_info()$survey) }) } shinyApp(ui, server) }
Shiny module server for forestcox
forestcoxServer( id, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, cluster_id = NULL, vec.event = NULL, vec.time = NULL )forestcoxServer( id, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, cluster_id = NULL, vec.event = NULL, vec.time = NULL )
id |
id |
data |
Reactive data |
data_label |
Reactive 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 |
cluster_id |
cluster option variable for marginal cox model |
vec.event |
event variables as vector for survival analysis, Default: NULL |
vec.time |
time variables as vector for survival analysis, Default: NULL |
Shiny module server for forestcox
Shiny module server for forestcox
data.table-package, setDT, setattr
TableSubgroupMultiCox
forest_theme, forest
dml
read_pptx, add_slide, ph_with, ph_location
library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) out <- mtcars ui <- fluidPage( sidebarLayout( sidebarPanel( forestcoxUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub"), ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestcoxServer("Forest", data = data, data_label = label) output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ a outtable()[[2]] }) }library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) out <- mtcars ui <- fluidPage( sidebarLayout( sidebarPanel( forestcoxUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub"), ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestcoxServer("Forest", data = data, data_label = label) output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ a outtable()[[2]] }) }
Shiny module UI for forestcox
forestcoxUI(id, label = "forestplot")forestcoxUI(id, label = "forestplot")
id |
id |
label |
label, Default: 'forestplot' |
Shinymodule UI for forestcox
Shinymodule UI
library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) out <- mtcars ui <- fluidPage( sidebarLayout( sidebarPanel( forestcoxUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub") ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestcoxServer("Forest", data = data, data_label = label) output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ outtable()[[2]] }) }library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) out <- mtcars ui <- fluidPage( sidebarLayout( sidebarPanel( forestcoxUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub") ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestcoxServer("Forest", data = data, data_label = label) output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ outtable()[[2]] }) }
Shiny module server for forestglm
forestglmServer( id, data, data_label, family, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, repeated_id = NULL )forestglmServer( id, data, data_label, family, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, repeated_id = NULL )
id |
id |
data |
Reactive data |
data_label |
Reactive data label |
family |
family, "gaussian" or "binomial" or 'poisson' or 'quasipoisson' |
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 |
repeated_id |
data when repeated id. default: F |
Shiny module server for forestglm
Shiny module server for forestglm
TableSubgroupMultiGLM
data.table-package,setDT, setattr
cor, coef
surveysummary, svytable
forest_theme, forest
dml
read_pptx, add_slide, ph_with, ph_location
library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) ui <- fluidPage( sidebarLayout( sidebarPanel( forestglmUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub"), ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) out <- mtcars server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestglmServer("Forest", data = data, data_label = label, family = "binomial") output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ outtable()[[2]] }) }library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) ui <- fluidPage( sidebarLayout( sidebarPanel( forestglmUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub"), ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) out <- mtcars server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestglmServer("Forest", data = data, data_label = label, family = "binomial") output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ outtable()[[2]] }) }
Shiny module UI for forestcox
forestglmUI(id, label = "forestplot")forestglmUI(id, label = "forestplot")
id |
id |
label |
label, Default: 'forestplot' |
Shinymodule UI for forestglm
Shinymodule UI
library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) ui <- fluidPage( sidebarLayout( sidebarPanel( forestglmUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub"), ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) out <- mtcars server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestglmServer("Forest", data = data, data_label = label, family = "binomial") output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ outtable()[[2]] }) }library(shiny) library(DT) mtcars$vs <- factor(mtcars$vs) mtcars$am <- factor(mtcars$am) mtcars$kk <- factor(as.integer(mtcars$disp >= 150)) mtcars$kk1 <- factor(as.integer(mtcars$disp >= 200)) ui <- fluidPage( sidebarLayout( sidebarPanel( forestglmUI("Forest") ), mainPanel( tabsetPanel( type = "pills", tabPanel( title = "Data", DTOutput("tablesub"), ), tabPanel( title = "figure", plotOutput("forestplot", width = "100%"), ggplotdownUI("Forest") ) ) ) ) ) out <- mtcars server <- function(input, output, session) { data <- reactive(out) label <- reactive(jstable::mk.lev(out)) outtable <- forestglmServer("Forest", data = data, data_label = label, family = "binomial") output$tablesub <- renderDT({ outtable()[[1]] }) output$forestplot <- renderPlot({ outtable()[[2]] }) }
Shiny modulde server for gaussian generalized estimating equation(GEE) using reactive data.
GEEModuleLinear( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, id.gee, vec.event = NULL )GEEModuleLinear( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, id.gee, vec.event = NULL )
input |
input |
output |
output |
session |
session |
data |
reactive data, ordered by id. |
data_label |
reactive data label |
data_varStruct |
List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
id.gee |
reactive repeated measure variable |
vec.event |
event variables as vector for gaussian generalized estimating equation(GEE), Default: NULL |
Shiny modulde server for gaussian generalized estimating equation(GEE) using reactive data.
Shiny modulde server for gaussian generalized estimating equation(GEE).
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( GEEModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) id.gee <- reactive("mpg") out_linear <- callModule(GEEModuleLinear, "linear", data = data, data_label = data.label, data_varStruct = NULL, id.gee = id.gee ) output$lineartable <- renderDT({ hide <- which(colnames(out_linear()$table) == "sig") datatable(out_linear()$table, rownames = T, extension = "Buttons", caption = out_linear()$caption, options = c( opt.tbreg(out_linear()$caption), list(columnDefs = list(list(visible = FALSE, targets = hide))), list(scrollX = TRUE) ) ) %>% formatStyle("sig", target = "row", backgroundColor = styleEqual("**", "yellow")) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( GEEModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) id.gee <- reactive("mpg") out_linear <- callModule(GEEModuleLinear, "linear", data = data, data_label = data.label, data_varStruct = NULL, id.gee = id.gee ) output$lineartable <- renderDT({ hide <- which(colnames(out_linear()$table) == "sig") datatable(out_linear()$table, rownames = T, extension = "Buttons", caption = out_linear()$caption, options = c( opt.tbreg(out_linear()$caption), list(columnDefs = list(list(visible = FALSE, targets = hide))), list(scrollX = TRUE) ) ) %>% formatStyle("sig", target = "row", backgroundColor = styleEqual("**", "yellow")) }) }
Shiny modulde server for binomial gaussian generalized estimating equation(GEE) using reactive data.
GEEModuleLogistic( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, id.gee, vec.event = NULL )GEEModuleLogistic( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, id.gee, vec.event = NULL )
input |
input |
output |
output |
session |
session |
data |
reactive data, ordered by id. |
data_label |
reactive data label |
data_varStruct |
List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
id.gee |
reactive repeated measure variable |
vec.event |
event variables as vector for binomial gaussian generalized estimating equation(GEE), Default: NULL |
Shiny modulde server for binomial gaussian generalized estimating equation(GEE) using reactive data.
Shiny modulde server for binomial gaussian generalized estimating equation(GEE).
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( GEEModuleUI("logistic") ), mainPanel( DTOutput("logistictable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) id.gee <- reactive("mpg") out_logistic <- callModule(GEEModuleLogistic, "logistic", data = data, data_label = data.label, data_varStruct = NULL, id.gee = id.gee ) output$logistictable <- renderDT({ hide <- which(colnames(out_logistic()$table) == "sig") datatable(out_logistic()$table, rownames = T, extension = "Buttons", caption = out_logistic()$caption, options = c( opt.tbreg(out_logistic()$caption), list(columnDefs = list(list(visible = FALSE, targets = hide))), list(scrollX = TRUE) ) ) %>% formatStyle("sig", target = "row", backgroundColor = styleEqual("**", "yellow")) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( GEEModuleUI("logistic") ), mainPanel( DTOutput("logistictable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) id.gee <- reactive("mpg") out_logistic <- callModule(GEEModuleLogistic, "logistic", data = data, data_label = data.label, data_varStruct = NULL, id.gee = id.gee ) output$logistictable <- renderDT({ hide <- which(colnames(out_logistic()$table) == "sig") datatable(out_logistic()$table, rownames = T, extension = "Buttons", caption = out_logistic()$caption, options = c( opt.tbreg(out_logistic()$caption), list(columnDefs = list(list(visible = FALSE, targets = hide))), list(scrollX = TRUE) ) ) %>% formatStyle("sig", target = "row", backgroundColor = styleEqual("**", "yellow")) }) }
Shiny modulde UI for generalized estimating equation(GEE).
GEEModuleUI(id)GEEModuleUI(id)
id |
id |
Shiny modulde UI for generalized estimating equation(GEE).
Shiny modulde UI for generalized estimating equation(GEE).
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( GEEModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) id.gee <- reactive("mpg") out_linear <- callModule(GEEModuleLinear, "linear", data = data, data_label = data.label, data_varStruct = NULL, id.gee = id.gee ) output$lineartable <- renderDT({ hide <- which(colnames(out_linear()$table) == "sig") datatable(out_linear()$table, rownames = T, extension = "Buttons", caption = out_linear()$caption, options = c( opt.tbreg(out_linear()$caption), list(columnDefs = list(list(visible = FALSE, targets = hide))), list(scrollX = TRUE) ) ) %>% formatStyle("sig", target = "row", backgroundColor = styleEqual("**", "yellow")) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( GEEModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) id.gee <- reactive("mpg") out_linear <- callModule(GEEModuleLinear, "linear", data = data, data_label = data.label, data_varStruct = NULL, id.gee = id.gee ) output$lineartable <- renderDT({ hide <- which(colnames(out_linear()$table) == "sig") datatable(out_linear()$table, rownames = T, extension = "Buttons", caption = out_linear()$caption, options = c( opt.tbreg(out_linear()$caption), list(columnDefs = list(list(visible = FALSE, targets = hide))), list(scrollX = TRUE) ) ) %>% formatStyle("sig", target = "row", backgroundColor = styleEqual("**", "yellow")) }) }
Shiny module server for basic/scatter plot.
ggpairsModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 20 )ggpairsModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 20 )
input |
input |
output |
output |
session |
session |
data |
data |
data_label |
data label |
data_varStruct |
List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit for categorical variables, Default: 20 |
Shiny module server for basic/scatter plot.
Shiny module server for basic/scatter plot.
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- mtcars data.label <- jstable::mk.lev(mtcars) out_ggpairs <- callModule(ggpairsModule, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- mtcars data.label <- jstable::mk.lev(mtcars) out_ggpairs <- callModule(ggpairsModule, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }
Shiny module server for basic/scatter plot for reactive data.
ggpairsModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 20 )ggpairsModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 20 )
input |
input |
output |
output |
session |
session |
data |
Reactive data |
data_label |
Reactive data label |
data_varStruct |
List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit for categorical variables, Default: 20 |
Shiny module server for basic/scatter plot for reactive data.
Shiny module server for basic/scatter plot
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_ggpairs <- callModule(ggpairsModule2, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_ggpairs <- callModule(ggpairsModule2, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }
Variable selection module UI for ggpairs
ggpairsModuleUI1(id)ggpairsModuleUI1(id)
id |
id |
Variable selection module UI for ggpairs
Variable selection module UI for ggpairs
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_ggpairs <- callModule(ggpairsModule2, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_ggpairs <- callModule(ggpairsModule2, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }
Option & download module UI for ggpairs
ggpairsModuleUI2(id)ggpairsModuleUI2(id)
id |
id |
Option & download module UI for ggpairs
Option & download module UI for ggpairs
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_ggpairs <- callModule(ggpairsModule2, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(GGally) ui <- fluidPage( sidebarLayout( sidebarPanel( ggpairsModuleUI1("ggpairs") ), mainPanel( plotOutput("ggpairs_plot"), ggpairsModuleUI2("ggpairs") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_ggpairs <- callModule(ggpairsModule2, "ggpairs", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_ggpairs()) }) }
Option & download module UI for ggplot
ggplotdownUI(id)ggplotdownUI(id)
id |
id |
Option & download module UI for ggplot
Option & download module UI for ggplot
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }
Shiny module server for histogram.
histogramServer( id, data, data_label, data_varStruct = NULL, nfactor.limit = 10 )histogramServer( id, data, data_label, data_varStruct = NULL, nfactor.limit = 10 )
id |
id |
data |
Reactive data |
data_label |
Reactive data label |
data_varStruct |
Reactive List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
Shiny module server for histogram.
Shiny module server for histogram.
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( histogramUI("histogram") ), mainPanel( plotOutput("histogram"), ggplotdownUI("histogram") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_histogram <- histogramServer("histogram", data = data, data_label = data.label, data_varStruct = NULL ) output$histogram <- renderPlot({ print(out_histogram()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( histogramUI("histogram") ), mainPanel( plotOutput("histogram"), ggplotdownUI("histogram") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_histogram <- histogramServer("histogram", data = data, data_label = data.label, data_varStruct = NULL ) output$histogram <- renderPlot({ print(out_histogram()) }) }
Shiny module UI for histogram
histogramUI(id, label = "histogram")histogramUI(id, label = "histogram")
id |
id |
label |
label |
Shiny module UI for histogram
Shiny module UI for histogram
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( histogramUI("histogram") ), mainPanel( plotOutput("histogram"), ggplotdownUI("histogram") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_histogram <- histogramServer("histogram", data = data, data_label = data.label, data_varStruct = NULL ) output$histogram <- renderPlot({ print(out_histogram()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( histogramUI("histogram") ), mainPanel( plotOutput("histogram"), ggplotdownUI("histogram") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_histogram <- histogramServer("histogram", data = data, data_label = data.label, data_varStruct = NULL ) output$histogram <- renderPlot({ print(out_histogram()) }) }
Detect if running in production/deployment environment
is_production_environment()is_production_environment()
Default is FALSE (development mode) when DEPLOYMENT_ENV is not set
Logical. TRUE if in production, FALSE if local development
Rstudio addin of jsBasicGadget
jsBasicAddin()jsBasicAddin()
Rstudio addin of jsBasicGadget
Rstudio addin of jsBasicGadget
if (interactive()) { jsBasicAddin() }if (interactive()) { jsBasicAddin() }
RStudio Addin for basic data analysis with external csv/xlsx/sas7bdat/sav/dta file.
jsBasicExtAddin(nfactor.limit = 20, max.filesize = 2048)jsBasicExtAddin(nfactor.limit = 20, max.filesize = 2048)
nfactor.limit |
nlevels limit for categorical variables, Default: 20 |
max.filesize |
Maximum file size to upload (MB), Default: 2048 (2 GB) |
RStudio Addin for basic data analysis with external csv/xlsx/sas7bdat/sav/dta file.
RStudio Addin for basic data analysis with external data.
if (interactive()) { jsBasicExtAddin() }if (interactive()) { jsBasicExtAddin() }
Shiny Gadget including Data, Label info, Table 1, Regression(linear, logistic), Basic plot
jsBasicGadget(data, nfactor.limit = 20)jsBasicGadget(data, nfactor.limit = 20)
data |
data |
nfactor.limit |
nlevels limit for categorical variables |
Shiny Gadget including Data, Label info, Table 1, Regression(linear, logistic), Basic plot
Shiny Gadget including Data, Label info, Table 1, Regression(linear, logistic), Basic plot
if (interactive()) { jsBasicGadget(mtcars) }if (interactive()) { jsBasicGadget(mtcars) }
Rstudio addin of jsPropensityGadget
jsPropensityAddin()jsPropensityAddin()
Rstudio addin of jsPropensityGadget
Rstudio addin of jsPropensityGadget
if (interactive()) { jsPropensityAddin() }if (interactive()) { jsPropensityAddin() }
RStudio Addin for propensity score analysis with external csv/xlsx/sas7bdat/sav/dta file.
jsPropensityExtAddin(nfactor.limit = 20, max.filesize = 2048)jsPropensityExtAddin(nfactor.limit = 20, max.filesize = 2048)
nfactor.limit |
nlevels limit for categorical variables, Default: 20 |
max.filesize |
Maximum file size to upload (MB), Default: 2048 (2 GB) |
RStudio Addin for propensity score analysis with external csv/xlsx/sas7bdat/sav/dta file.
RStudio Addin for propensity score analysis with external data.
pbc
fwrite,data.table
svydesign
opt.tbreg
if (interactive()) { jsPropensityExtAddin() }if (interactive()) { jsPropensityExtAddin() }
Shiny Gadget including original/matching/IPTW data, Label info, Table 1, Cox model, Basic/kaplan-meier plot.
jsPropensityGadget(data, nfactor.limit = 20)jsPropensityGadget(data, nfactor.limit = 20)
data |
data |
nfactor.limit |
nlevels limit for categorical variables, Default: 20 |
Shiny Gadget including original/matching/IPTW data, Label info, Table 1, Cox model, Basic/kaplan-meier plot.
Shiny Gadget including original/matching/IPTW data, Label info, Table 1, Cox model, Basic/kaplan-meier plot.
data.table
matchit,match.data
cox2.display,svycox.display
survfit,coxph,Surv
jskm,svyjskm
ggsave
svykm
if (interactive()) { jsPropensityGadget(mtcars) }if (interactive()) { jsPropensityGadget(mtcars) }
Rstudio addin of jsRepeatedGadget
jsRepeatedAddin()jsRepeatedAddin()
Rstudio addin of jsRepeatedGadget
Rstudio addin of jsRepeatedGadget
if (interactive()) { jsRepeatedAddin() }if (interactive()) { jsRepeatedAddin() }
RStudio Addin for repeated measure analysis with external csv/xlsx/sas7bdat/sav/dta file.
jsRepeatedExtAddin(nfactor.limit = 20, max.filesize = 2048)jsRepeatedExtAddin(nfactor.limit = 20, max.filesize = 2048)
nfactor.limit |
nlevels limit for categorical variables, Default: 20 |
max.filesize |
Maximum file size to upload (MB), Default: 2048 (2 GB) |
RStudio Addin for repeated measure analysis with external csv/xlsx/sas7bdat/sav/dta file.
RStudio Addin for repeated measure analysis with external data.
if (interactive()) { jsRepeatedExtAddin() }if (interactive()) { jsRepeatedExtAddin() }
Shiny Gadget including Data, Label info, Table 1, GEE(linear, logistic), Basic plot
jsRepeatedGadget(data, nfactor.limit = 20)jsRepeatedGadget(data, nfactor.limit = 20)
data |
data |
nfactor.limit |
nlevels limit for categorical variables |
Shiny Gadget including Data, Label info, Table 1, GEE(linear, logistic), Basic plot
Shiny Gadget including Data, Label info, Table 1, GEE(linear, logistic), Basic plot
if (interactive()) { jsRepeatedGadget(mtcars) }if (interactive()) { jsRepeatedGadget(mtcars) }
Rstudio addin of jsSurveyGadget
jsSurveyAddin()jsSurveyAddin()
Rstudio addin of jsSurveyGadget
Rstudio addin of jsSurveyGadget
if (interactive()) { jsSurveydAddin() }if (interactive()) { jsSurveydAddin() }
RStudio Addin for survey data analysis with external csv/xlsx/sas7bdat/sav/dta file.
jsSurveyExtAddin(nfactor.limit = 20, max.filesize = 2048)jsSurveyExtAddin(nfactor.limit = 20, max.filesize = 2048)
nfactor.limit |
nlevels limit for categorical variables, Default: 20 |
max.filesize |
Maximum file size to upload (MB), Default: 2048 (2 GB) |
RStudio Addin for survey data analysis with external csv/xlsx/sas7bdat/sav/dta file.
RStudio Addin for survey data analysis with external data.
if (interactive()) { jsSurveyExtAddin() }if (interactive()) { jsSurveyExtAddin() }
Shiny Gadget including Data, Label info, Table 1, svyglm, Basic plot
jsSurveyGadget(data, nfactor.limit = 20)jsSurveyGadget(data, nfactor.limit = 20)
data |
data |
nfactor.limit |
nlevels limit for categorical variables |
Shiny Gadget including Data, Label info, Table 1, svyglm, Basic plot
Shiny Gadget including Data, Label info, Table 1, svyglm, Basic plot
if (interactive()) { jsSurveyGadget(mtcars) }if (interactive()) { jsSurveyGadget(mtcars) }
Shiny module server for kaplan-meier plot.
kaplanModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL, timeby = NULL, range.x = NULL, range.y = NULL, vec.event = NULL, vec.time = NULL )kaplanModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL, timeby = NULL, range.x = NULL, range.y = NULL, vec.event = NULL, vec.time = NULL )
input |
input |
output |
output |
session |
session |
data |
Reactive data |
data_label |
Reactive 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 |
timeby |
timeby, Default: NULL |
range.x |
range of x axis, Default: NULL |
range.y |
range of y axis, Default: NULL |
vec.event |
event variables as vector for survival analysis, Default: NULL |
vec.time |
time variables as vector for survival analysis, Default: NULL |
Shiny module server for kaplan-meier plot.
Shiny module server for kaplan-meier plot.
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }
Shiny module UI for kaplan-meier plot
kaplanUI(id)kaplanUI(id)
id |
id |
Shiny module UI for kaplan-meier plot
Shiny module UI for kaplan-meier plot
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }
Shiny module server for lineplot.
lineServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)lineServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)
id |
id |
data |
Reactive data |
data_label |
Reactive data label |
data_varStruct |
Reactive List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
Shiny module server for lineplot.
Shiny module server for lineplot.
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( lineUI("line") ), mainPanel( optionUI("line"), plotOutput("line_plot"), ggplotdownUI("line") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_line <- lineServer("line", data = data, data_label = data.label, data_varStruct = NULL ) output$line_plot <- renderPlot({ print(out_line()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( lineUI("line") ), mainPanel( optionUI("line"), plotOutput("line_plot"), ggplotdownUI("line") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_line <- lineServer("line", data = data, data_label = data.label, data_varStruct = NULL ) output$line_plot <- renderPlot({ print(out_line()) }) }
Shiny module UI for lineplot
lineUI(id, label = "lineplot")lineUI(id, label = "lineplot")
id |
id |
label |
label |
Shiny module UI for lineplot
Shiny module UI for lineplot
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( lineUI("line") ), mainPanel( optionUI("line"), plotOutput("line_plot"), ggplotdownUI("line") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_line <- lineServer("line", data = data, data_label = data.label, data_varStruct = NULL ) output$line_plot <- renderPlot({ print(out_line()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( lineUI("line") ), mainPanel( optionUI("line"), plotOutput("line_plot"), ggplotdownUI("line") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_line <- lineServer("line", data = data, data_label = data.label, data_varStruct = NULL ) output$line_plot <- renderPlot({ print(out_line()) }) }
Modified epiDisplay's logistic.display function for reactive data.
logistic.display2( logistic.model, alpha = 0.05, crude = TRUE, crude.p.value = FALSE, decimal = 2, simplified = FALSE )logistic.display2( logistic.model, alpha = 0.05, crude = TRUE, crude.p.value = FALSE, decimal = 2, simplified = FALSE )
logistic.model |
glm object(binomial) |
alpha |
alpha, Default: 0.05 |
crude |
crude, Default: TRUE |
crude.p.value |
crude.p.value, Default: FALSE |
decimal |
decimal, Default: 2 |
simplified |
simplified, Default: FALSE |
Modified epiDisplay's logistic.display function for reactive data.
logistic table
model1 <- glm(am ~ cyl + disp, data = mtcars, family = binomial) logistic.display2(model1, crude = TRUE, crude.p.value = TRUE, decimal = 3)model1 <- glm(am ~ cyl + disp, data = mtcars, family = binomial) logistic.display2(model1, crude = TRUE, crude.p.value = TRUE, decimal = 3)
Shiny modulde server for logistic regression for reactive data.
logisticModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 20, vec.event = NULL )logisticModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 20, vec.event = NULL )
input |
input |
output |
output |
session |
session |
data |
reactive data |
data_label |
reactive data label |
data_varStruct |
List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
design.survey |
reactive survey data. default: NULL |
default.unires |
Set default independent variables using univariate analysis, Default: T |
limit.unires |
Change to default.unires = F if number of independent variables > limit.unires, Default: 20 |
vec.event |
event variables as vector for logistic regression, Default: NULL |
Shiny modulde server for logistic regression.
Shiny modulde server for logistic regression.
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( regressModuleUI("logistic") ), mainPanel( DTOutput("logistictable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_logistic <- callModule(logisticModule2, "logistic", data = data, data_label = data.label, data_varStruct = NULL ) output$logistictable <- renderDT({ datatable(out_logistic()$table, rownames = T, caption = out_logistic()$caption) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( regressModuleUI("logistic") ), mainPanel( DTOutput("logistictable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_logistic <- callModule(logisticModule2, "logistic", data = data, data_label = data.label, data_varStruct = NULL ) output$logistictable <- renderDT({ datatable(out_logistic()$table, rownames = T, caption = out_logistic()$caption) }) }
make level for sav files with labels pre defined from SPSS
mk.lev2(out.old, out.label)mk.lev2(out.old, out.label)
out.old |
raw data |
out.label |
pre-defined label data |
out.label data labels updated
Function to make variable list lncluding specific variables.
mklist(varlist, vars)mklist(varlist, vars)
varlist |
Original variable list. |
vars |
variable to include. |
Internal function
variable list lncluding specific variables.
data_varStruct <- list(variable = names(mtcars)) mklist(data_varStruct, names(mtcars))data_varStruct <- list(variable = names(mtcars)) mklist(data_varStruct, names(mtcars))
Function to make variable list excluding specific variables.
mksetdiff(varlist, vars)mksetdiff(varlist, vars)
varlist |
Original variable list |
vars |
variable to exclude. |
Internal function
variable list excluding specific variables.
data_varStruct <- list(variable = names(mtcars)) mksetdiff(data_varStruct, "mpg")data_varStruct <- list(variable = names(mtcars)) mksetdiff(data_varStruct, "mpg")
Option UI with icon
optionUI(id)optionUI(id)
id |
id |
Option UI with icon
Option UI with icon
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( optionUI("kaplan"), plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) ui <- fluidPage( sidebarLayout( sidebarPanel( kaplanUI("kaplan") ), mainPanel( optionUI("kaplan"), plotOutput("kaplan_plot"), ggplotdownUI("kaplan") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_kaplan <- callModule(kaplanModule, "kaplan", data = data, data_label = data.label, data_varStruct = NULL ) output$kaplan_plot <- renderPlot({ print(out_kaplan()) }) }
Modified function of PredictABEL::reclassification: return output table
reclassificationJS( data, cOutcome, predrisk1, predrisk2, cutoff, dec.value = 3, dec.p = 3 )reclassificationJS( data, cOutcome, predrisk1, predrisk2, cutoff, dec.value = 3, dec.p = 3 )
data |
Data frame or matrix that includes the outcome and predictors variables. |
cOutcome |
Column number of the outcome variable. |
predrisk1 |
Vector of predicted risks of all individuals using initial model. |
predrisk2 |
Vector of predicted risks of all individuals using updated model. |
cutoff |
Cutoff values for risk categories. Define the cut-off values. Ex: c(0,.20,.30,1) |
dec.value |
digits of value, Default: 4 |
dec.p |
digits of p, Default: 3 |
Modified function of PredictABEL::reclassification
Table including NRI(categorical), NRI(continuous), IDI with 95
m1 <- glm(vs ~ am + gear, data = mtcars, family = binomial) m2 <- glm(vs ~ am + gear + wt, data = mtcars, family = binomial) reclassificationJS( data = mtcars, cOutcome = 8, predrisk1 = predict(m1, type = "response"), predrisk2 = predict(m2, type = "response"), cutoff = c(0, .20, .40, 1) )m1 <- glm(vs ~ am + gear, data = mtcars, family = binomial) m2 <- glm(vs ~ am + gear + wt, data = mtcars, family = binomial) reclassificationJS( data = mtcars, cOutcome = 8, predrisk1 = predict(m1, type = "response"), predrisk2 = predict(m2, type = "response"), cutoff = c(0, .20, .40, 1) )
regress.display function for reactive data
regress.display2( regress.model, alpha = 0.05, crude = FALSE, crude.p.value = FALSE, decimal = 2, simplified = FALSE )regress.display2( regress.model, alpha = 0.05, crude = FALSE, crude.p.value = FALSE, decimal = 2, simplified = FALSE )
regress.model |
lm object |
alpha |
alpha, Default: 0.05 |
crude |
crude, Default: FALSE |
crude.p.value |
crude.p.value, Default: FALSE |
decimal |
decimal, Default: 2 |
simplified |
simplified, Default: FALSE |
regress.display function for reactive data
regress table
model1 <- glm(mpg ~ cyl + disp + vs, data = mtcars) regress.display2(model1, crude = TRUE, crude.p.value = TRUE, decimal = 3)model1 <- glm(mpg ~ cyl + disp + vs, data = mtcars) regress.display2(model1, crude = TRUE, crude.p.value = TRUE, decimal = 3)
Shiny modulde server for linear regression for reactive data.
regressModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 20, vec.event = NULL )regressModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 20, vec.event = NULL )
input |
input |
output |
output |
session |
session |
data |
reactive data |
data_label |
reactive data label |
data_varStruct |
List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
design.survey |
reactive survey data. default: NULL |
default.unires |
Set default independent variables using univariate analysis, Default: T |
limit.unires |
Change to default.unires = F if number of independent variables > limit.unires, Default: 20 |
vec.event |
event variables as vector for linear regression, Default: NULL |
Shiny modulde server for linear regression.
Shiny modulde server for linear regression.
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( regressModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_linear <- callModule(regressModule2, "linear", data = data, data_label = data.label, data_varStruct = NULL ) output$lineartable <- renderDT({ datatable(out_linear()$table, rownames = T, caption = out_linear()$caption) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( regressModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_linear <- callModule(regressModule2, "linear", data = data, data_label = data.label, data_varStruct = NULL ) output$lineartable <- renderDT({ datatable(out_linear()$table, rownames = T, caption = out_linear()$caption) }) }
Shiny modulde UI for linear regression.
regressModuleUI(id)regressModuleUI(id)
id |
id |
Shiny modulde UI for linear regression.
Shiny modulde UI for linear regression.
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( regressModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_linear <- callModule(regressModule2, "linear", data = data, data_label = data.label, data_varStruct = NULL ) output$lineartable <- renderDT({ datatable(out_linear()$table, rownames = T, caption = out_linear()$caption) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( regressModuleUI("linear") ), mainPanel( DTOutput("lineartable") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_linear <- callModule(regressModule2, "linear", data = data, data_label = data.label, data_varStruct = NULL ) output$lineartable <- renderDT({ datatable(out_linear()$table, rownames = T, caption = out_linear()$caption) }) }
extract AUC, NRI and IDI information from list of roc in pROC packages
ROC_table(ListModel, dec.auc = 3, dec.p = 3)ROC_table(ListModel, dec.auc = 3, dec.p = 3)
ListModel |
list of roc object |
dec.auc |
digits for AUC, Default: 3 |
dec.p |
digits for p value, Default: 3 |
extract AUC, NRI and IDI information from list of roc object in pROC packages.
table of AUC, NRI and IDI information
ci.auc,roc.test
data.table, rbindlist
library(pROC) m1 <- glm(vs ~ am + gear, data = mtcars, family = binomial) m2 <- glm(vs ~ am + gear + wt, data = mtcars, family = binomial) m3 <- glm(vs ~ am + gear + wt + mpg, data = mtcars, family = binomial) roc1 <- roc(m1$y, predict(m1, type = "response")) roc2 <- roc(m2$y, predict(m2, type = "response")) roc3 <- roc(m3$y, predict(m3, type = "response")) list.roc <- list(roc1, roc2, roc3) ROC_table(list.roc)library(pROC) m1 <- glm(vs ~ am + gear, data = mtcars, family = binomial) m2 <- glm(vs ~ am + gear + wt, data = mtcars, family = binomial) m3 <- glm(vs ~ am + gear + wt + mpg, data = mtcars, family = binomial) roc1 <- roc(m1$y, predict(m1, type = "response")) roc2 <- roc(m2$y, predict(m2, type = "response")) roc3 <- roc(m3$y, predict(m3, type = "response")) list.roc <- list(roc1, roc2, roc3) ROC_table(list.roc)
shiny module server for roc analysis
rocModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL )rocModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL )
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 |
shiny module server for roc analysis
shiny module server for roc analysis
quantile
setkey
ggroc
geeglm
svyglm
theme_modern
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({ if (is.null(out_roc()$cut)) return(NULL) 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)) ) }) }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({ if (is.null(out_roc()$cut)) return(NULL) 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)) ) }) }
shiny module server for roc analysis- input number of model as integer
rocModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL )rocModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL )
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 |
shiny module server for roc analysis- input number of model as integer
shiny module server for roc analysis- input number of model as integer
quantile
setkey
ggroc
geeglm
svyglm
theme_modern
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(rocModule2, "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)) ) }) }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(rocModule2, "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)) ) }) }
Shiny module UI for roc analysis
rocUI(id)rocUI(id)
id |
id |
Shiny module UI for roc analysis
Shiny module UI for roc analysis
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({ if (is.null(out_roc()$cut)) return(NULL) 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)) ) }) }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({ if (is.null(out_roc()$cut)) return(NULL) 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)) ) }) }
Safe evaluation wrapper with environment-aware security
safe_eval_expr(expr, envir, timeout = 10)safe_eval_expr(expr, envir, timeout = 10)
expr |
Expression to evaluate |
envir |
Environment for evaluation |
timeout |
Timeout in seconds (default: 10) |
In production mode, uses RAppArmor::eval.secure if available. In development mode, uses standard eval for easier debugging.
Evaluation result
Shiny module server for scatterplot.
scatterServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)scatterServer(id, data, data_label, data_varStruct = NULL, nfactor.limit = 10)
id |
id |
data |
Reactive data |
data_label |
Reactive data label |
data_varStruct |
Reactive List of variable structure, Default: NULL |
nfactor.limit |
nlevels limit in factor variable, Default: 10 |
Shiny module server for scatterplot.
Shiny module server for scatterplot.
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( scatterUI("scatter") ), mainPanel( optionUI("scatter"), plotOutput("scatter_plot"), ggplotdownUI("scatter") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_scatter <- scatterServer("scatter", data = data, data_label = data.label, data_varStruct = NULL ) output$scatter_plot <- renderPlot({ print(out_scatter()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( scatterUI("scatter") ), mainPanel( optionUI("scatter"), plotOutput("scatter_plot"), ggplotdownUI("scatter") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_scatter <- scatterServer("scatter", data = data, data_label = data.label, data_varStruct = NULL ) output$scatter_plot <- renderPlot({ print(out_scatter()) }) }
Shiny module UI for scatterplot
scatterUI(id, label = "scatterplot")scatterUI(id, label = "scatterplot")
id |
id |
label |
label |
Shiny module UI for scatterplot
Shiny module UI for scatterplot
library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( scatterUI("scatter") ), mainPanel( optionUI("scatter"), plotOutput("scatter_plot"), ggplotdownUI("scatter") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_scatter <- scatterServer("scatter", data = data, data_label = data.label, data_varStruct = NULL ) output$scatter_plot <- renderPlot({ print(out_scatter()) }) }library(shiny) library(ggplot2) library(ggpubr) ui <- fluidPage( sidebarLayout( sidebarPanel( scatterUI("scatter") ), mainPanel( optionUI("scatter"), plotOutput("scatter_plot"), ggplotdownUI("scatter") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_scatter <- scatterServer("scatter", data = data, data_label = data.label, data_varStruct = NULL ) output$scatter_plot <- renderPlot({ print(out_scatter()) }) }
Helper function for IDI.INF.OUT in survIDINRI packages
survIDINRI_helper( var.event, var.time, list.vars.ind, t, data, dec.auc = 3, dec.p = 3, id.cluster = NULL )survIDINRI_helper( var.event, var.time, list.vars.ind, t, data, dec.auc = 3, dec.p = 3, id.cluster = NULL )
var.event |
event |
var.time |
time |
list.vars.ind |
list of independent variable |
t |
time |
data |
data |
dec.auc |
digits for AUC, Default: 3 |
dec.p |
digits for p value, Default: 3 |
id.cluster |
cluster variable if marginal model, Default: NULL |
Helper function for IDI.INF.OUT in survIDINRI packages
IDI, NRI
data.table
model.matrix
coxph
Surv
IDI.INF.OUT
IDI.INF
# library(survival) # survIDINRI_helper("status", "time", list.vars.ind = list("age", c("age", "sex")), # t = 365, data = lung)# library(survival) # survIDINRI_helper("status", "time", list.vars.ind = list("age", c("age", "sex")), # t = 365, data = lung)
Table 1 shiny module server for descriptive statistics.
tb1module( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, showAllLevels = T, argsExact = list(workspace = 2 * 10^7, simulate.p.value = T) )tb1module( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, showAllLevels = T, argsExact = list(workspace = 2 * 10^7, simulate.p.value = T) )
input |
input |
output |
output |
session |
session |
data |
Data |
data_label |
Data label |
data_varStruct |
Variable structure list of data, Default: NULL |
nfactor.limit |
maximum factor levels to include, Default: 10 |
design.survey |
survey data of survey package. default: NULL |
showAllLevels |
Show All label information with 2 categorical variables, Default: T |
argsExact |
Option for Fisher exact test memory limit. |
Table 1 shiny module server for descriptive statistics.
Table 1 shiny module server for descriptive statistics.
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( tb1moduleUI("tb1") ), mainPanel( DTOutput("table1") ) ) ) server <- function(input, output, session) { data <- mtcars data.label <- jstable::mk.lev(mtcars) out_tb1 <- callModule(tb1module, "tb1", data = data, data_label = data.label, data_varStruct = NULL ) output$table1 <- renderDT({ tb <- out_tb1()$table cap <- out_tb1()$caption out.tb1 <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out.tb1) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( tb1moduleUI("tb1") ), mainPanel( DTOutput("table1") ) ) ) server <- function(input, output, session) { data <- mtcars data.label <- jstable::mk.lev(mtcars) out_tb1 <- callModule(tb1module, "tb1", data = data, data_label = data.label, data_varStruct = NULL ) output$table1 <- renderDT({ tb <- out_tb1()$table cap <- out_tb1()$caption out.tb1 <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out.tb1) }) }
Table 1 shiny module server for descriptive statistics for reactive data.
tb1module2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, showAllLevels = T, argsExact = list(workspace = 2 * 10^7, simulate.p.value = T) )tb1module2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, showAllLevels = T, argsExact = list(workspace = 2 * 10^7, simulate.p.value = T) )
input |
input |
output |
output |
session |
session |
data |
Reactive data |
data_label |
Reactive data label |
data_varStruct |
Variable structure list of data, Default: NULL |
nfactor.limit |
maximum factor levels to include, Default: 10 |
design.survey |
Reactive survey data of survey package. Default: NULL |
showAllLevels |
Show All label information with 2 categorical variables, Default: T |
argsExact |
Option for Fisher exact test memory limit. |
Table 1 shiny module server for descriptive statistics.
Table 1 shiny module server for descriptive statistics.
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( tb1moduleUI("tb1") ), mainPanel( DTOutput("table1") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_tb1 <- callModule(tb1module2, "tb1", data = data, data_label = data.label, data_varStruct = NULL ) output$table1 <- renderDT({ tb <- out_tb1()$table cap <- out_tb1()$caption out.tb1 <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out.tb1) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( tb1moduleUI("tb1") ), mainPanel( DTOutput("table1") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_tb1 <- callModule(tb1module2, "tb1", data = data, data_label = data.label, data_varStruct = NULL ) output$table1 <- renderDT({ tb <- out_tb1()$table cap <- out_tb1()$caption out.tb1 <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out.tb1) }) }
Table 1 shiny module UI for descriptive statistics.
tb1moduleUI(id)tb1moduleUI(id)
id |
id |
Table 1 shiny module UI for descriptive statistics.
Table 1 module UI.
library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( tb1moduleUI("tb1") ), mainPanel( DTOutput("table1") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_tb1 <- callModule(tb1module2, "tb1", data = data, data_label = data.label, data_varStruct = NULL ) output$table1 <- renderDT({ tb <- out_tb1()$table cap <- out_tb1()$caption out.tb1 <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out.tb1) }) }library(shiny) library(DT) library(data.table) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( tb1moduleUI("tb1") ), mainPanel( DTOutput("table1") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- reactive(jstable::mk.lev(mtcars)) out_tb1 <- callModule(tb1module2, "tb1", data = data, data_label = data.label, data_varStruct = NULL ) output$table1 <- renderDT({ tb <- out_tb1()$table cap <- out_tb1()$caption out.tb1 <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out.tb1) }) }
Table 1 module server for propensity score analysis
tb1simple( input, output, session, data, matdata, data_label, data_varStruct = NULL, group_var, showAllLevels = T )tb1simple( input, output, session, data, matdata, data_label, data_varStruct = NULL, group_var, showAllLevels = T )
input |
input |
output |
output |
session |
session |
data |
Original data with propensity score |
matdata |
Matching data |
data_label |
Data label |
data_varStruct |
List of variable structure, Default: NULL |
group_var |
Group variable to run propensity score analysis. |
showAllLevels |
Show All label information with 2 categorical variables, Default: T |
Table 1 module server for propensity score analysis
Table 1 with original data/matching data/IPTW data
var_label
CreateTableOneJS
svydesign
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) library(haven) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile"), tb1simpleUI("tb1") ), mainPanel( DTOutput("table1_original"), DTOutput("table1_ps"), DTOutput("table1_iptw") ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") data <- reactive(mat.info()$data) matdata <- reactive(mat.info()$matdata) data.label <- reactive(mat.info()$data.label) vlist <- eventReactive(mat.info(), { mklist <- function(varlist, vars) { lapply( varlist, function(x) { inter <- intersect(x, vars) if (length(inter) == 1) { inter <- c(inter, "") } return(inter) } ) } factor_vars <- names(data())[data()[, lapply(.SD, class) %in% c("factor", "character")]] factor_list <- mklist(data_varStruct(), factor_vars) conti_vars <- setdiff(names(data()), c(factor_vars, "pscore", "iptw")) conti_list <- mklist(data_varStruct(), conti_vars) nclass_factor <- unlist(data()[, lapply(.SD, function(x) { length(unique(x)[!is.na(unique(x))]) }), .SDcols = factor_vars ]) class01_factor <- unlist(data()[, lapply(.SD, function(x) { identical(levels(x), c("0", "1")) }), .SDcols = factor_vars ]) validate( need(!is.null(class01_factor), "No categorical variables coded as 0, 1 in data") ) factor_01vars <- factor_vars[class01_factor] factor_01_list <- mklist(data_varStruct(), factor_01vars) group_vars <- factor_vars[nclass_factor >= 2 & nclass_factor <= 10 & nclass_factor < nrow(data())] group_list <- mklist(data_varStruct(), group_vars) except_vars <- factor_vars[nclass_factor > 10 | nclass_factor == 1 | nclass_factor == nrow(data())] ## non-normal: shapiro test f <- function(x) { if (diff(range(x, na.rm = T)) == 0) { return(F) } else { return(shapiro.test(x)$p.value <= 0.05) } } non_normal <- ifelse(nrow(data()) <= 3 | nrow(data()) >= 5000, rep(F, length(conti_vars)), sapply(conti_vars, function(x) { f(data()[[x]]) }) ) return(list( factor_vars = factor_vars, factor_list = factor_list, conti_vars = conti_vars, conti_list = conti_list, factor_01vars = factor_01vars, factor_01_list = factor_01_list, group_list = group_list, except_vars = except_vars, non_normal = non_normal )) }) out.tb1 <- callModule(tb1simple2, "tb1", data = data, matdata = matdata, data_label = data.label, data_varStruct = NULL, vlist = vlist, group_var = reactive(mat.info()$group_var) ) output$table1_original <- renderDT({ tb <- out.tb1()$original$table cap <- out.tb1()$original$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_ps <- renderDT({ tb <- out.tb1()$ps$table cap <- out.tb1()$ps$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_iptw <- renderDT({ tb <- out.tb1()$iptw$table cap <- out.tb1()$iptw$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) }library(shiny) library(DT) library(data.table) library(readxl) library(jstable) library(haven) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile"), tb1simpleUI("tb1") ), mainPanel( DTOutput("table1_original"), DTOutput("table1_ps"), DTOutput("table1_iptw") ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") data <- reactive(mat.info()$data) matdata <- reactive(mat.info()$matdata) data.label <- reactive(mat.info()$data.label) vlist <- eventReactive(mat.info(), { mklist <- function(varlist, vars) { lapply( varlist, function(x) { inter <- intersect(x, vars) if (length(inter) == 1) { inter <- c(inter, "") } return(inter) } ) } factor_vars <- names(data())[data()[, lapply(.SD, class) %in% c("factor", "character")]] factor_list <- mklist(data_varStruct(), factor_vars) conti_vars <- setdiff(names(data()), c(factor_vars, "pscore", "iptw")) conti_list <- mklist(data_varStruct(), conti_vars) nclass_factor <- unlist(data()[, lapply(.SD, function(x) { length(unique(x)[!is.na(unique(x))]) }), .SDcols = factor_vars ]) class01_factor <- unlist(data()[, lapply(.SD, function(x) { identical(levels(x), c("0", "1")) }), .SDcols = factor_vars ]) validate( need(!is.null(class01_factor), "No categorical variables coded as 0, 1 in data") ) factor_01vars <- factor_vars[class01_factor] factor_01_list <- mklist(data_varStruct(), factor_01vars) group_vars <- factor_vars[nclass_factor >= 2 & nclass_factor <= 10 & nclass_factor < nrow(data())] group_list <- mklist(data_varStruct(), group_vars) except_vars <- factor_vars[nclass_factor > 10 | nclass_factor == 1 | nclass_factor == nrow(data())] ## non-normal: shapiro test f <- function(x) { if (diff(range(x, na.rm = T)) == 0) { return(F) } else { return(shapiro.test(x)$p.value <= 0.05) } } non_normal <- ifelse(nrow(data()) <= 3 | nrow(data()) >= 5000, rep(F, length(conti_vars)), sapply(conti_vars, function(x) { f(data()[[x]]) }) ) return(list( factor_vars = factor_vars, factor_list = factor_list, conti_vars = conti_vars, conti_list = conti_list, factor_01vars = factor_01vars, factor_01_list = factor_01_list, group_list = group_list, except_vars = except_vars, non_normal = non_normal )) }) out.tb1 <- callModule(tb1simple2, "tb1", data = data, matdata = matdata, data_label = data.label, data_varStruct = NULL, vlist = vlist, group_var = reactive(mat.info()$group_var) ) output$table1_original <- renderDT({ tb <- out.tb1()$original$table cap <- out.tb1()$original$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_ps <- renderDT({ tb <- out.tb1()$ps$table cap <- out.tb1()$ps$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_iptw <- renderDT({ tb <- out.tb1()$iptw$table cap <- out.tb1()$iptw$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) }
tb1 module for propensity score analysis for reactive data
tb1simple2( input, output, session, data, matdata, data_label, data_varStruct = NULL, vlist, group_var, showAllLevels = T )tb1simple2( input, output, session, data, matdata, data_label, data_varStruct = NULL, vlist, group_var, showAllLevels = T )
input |
input |
output |
output |
session |
session |
data |
Original reactive data with propensity score |
matdata |
Matching reactive data |
data_label |
Reactive data label |
data_varStruct |
List of variable structure, Default: NULL |
vlist |
List including factor/continuous/binary/except/non-normal variables |
group_var |
Group variable to run propensity score analysis. |
showAllLevels |
Show All label information with 2 categorical variables, Default: T |
Table 1 module server for propensity score analysis
Table 1 with original data/matching data/IPTW data
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) library(haven) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile"), tb1simpleUI("tb1") ), mainPanel( DTOutput("table1_original"), DTOutput("table1_ps"), DTOutput("table1_iptw") ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") data <- reactive(mat.info()$data) matdata <- reactive(mat.info()$matdata) data.label <- reactive(mat.info()$data.label) vlist <- eventReactive(mat.info(), { mklist <- function(varlist, vars) { lapply( varlist, function(x) { inter <- intersect(x, vars) if (length(inter) == 1) { inter <- c(inter, "") } return(inter) } ) } factor_vars <- names(data())[data()[, lapply(.SD, class) %in% c("factor", "character")]] factor_list <- mklist(data_varStruct(), factor_vars) conti_vars <- setdiff(names(data()), c(factor_vars, "pscore", "iptw")) conti_list <- mklist(data_varStruct(), conti_vars) nclass_factor <- unlist(data()[, lapply(.SD, function(x) { length(unique(x)[!is.na(unique(x))]) }), .SDcols = factor_vars ]) class01_factor <- unlist(data()[, lapply(.SD, function(x) { identical(levels(x), c("0", "1")) }), .SDcols = factor_vars ]) validate( need(!is.null(class01_factor), "No categorical variables coded as 0, 1 in data") ) factor_01vars <- factor_vars[class01_factor] factor_01_list <- mklist(data_varStruct(), factor_01vars) group_vars <- factor_vars[nclass_factor >= 2 & nclass_factor <= 10 & nclass_factor < nrow(data())] group_list <- mklist(data_varStruct(), group_vars) except_vars <- factor_vars[nclass_factor > 10 | nclass_factor == 1 | nclass_factor == nrow(data())] ## non-normal: shapiro test f <- function(x) { if (diff(range(x, na.rm = T)) == 0) { return(F) } else { return(shapiro.test(x)$p.value <= 0.05) } } non_normal <- ifelse(nrow(data()) <= 3 | nrow(data()) >= 5000, rep(F, length(conti_vars)), sapply(conti_vars, function(x) { f(data()[[x]]) }) ) return(list( factor_vars = factor_vars, factor_list = factor_list, conti_vars = conti_vars, conti_list = conti_list, factor_01vars = factor_01vars, factor_01_list = factor_01_list, group_list = group_list, except_vars = except_vars, non_normal = non_normal )) }) out.tb1 <- callModule(tb1simple2, "tb1", data = data, matdata = matdata, data_label = data.label, data_varStruct = NULL, vlist = vlist, group_var = reactive(mat.info()$group_var) ) output$table1_original <- renderDT({ tb <- out.tb1()$original$table cap <- out.tb1()$original$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_ps <- renderDT({ tb <- out.tb1()$ps$table cap <- out.tb1()$ps$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_iptw <- renderDT({ tb <- out.tb1()$iptw$table cap <- out.tb1()$iptw$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) }library(shiny) library(DT) library(data.table) library(readxl) library(jstable) library(haven) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile"), tb1simpleUI("tb1") ), mainPanel( DTOutput("table1_original"), DTOutput("table1_ps"), DTOutput("table1_iptw") ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") data <- reactive(mat.info()$data) matdata <- reactive(mat.info()$matdata) data.label <- reactive(mat.info()$data.label) vlist <- eventReactive(mat.info(), { mklist <- function(varlist, vars) { lapply( varlist, function(x) { inter <- intersect(x, vars) if (length(inter) == 1) { inter <- c(inter, "") } return(inter) } ) } factor_vars <- names(data())[data()[, lapply(.SD, class) %in% c("factor", "character")]] factor_list <- mklist(data_varStruct(), factor_vars) conti_vars <- setdiff(names(data()), c(factor_vars, "pscore", "iptw")) conti_list <- mklist(data_varStruct(), conti_vars) nclass_factor <- unlist(data()[, lapply(.SD, function(x) { length(unique(x)[!is.na(unique(x))]) }), .SDcols = factor_vars ]) class01_factor <- unlist(data()[, lapply(.SD, function(x) { identical(levels(x), c("0", "1")) }), .SDcols = factor_vars ]) validate( need(!is.null(class01_factor), "No categorical variables coded as 0, 1 in data") ) factor_01vars <- factor_vars[class01_factor] factor_01_list <- mklist(data_varStruct(), factor_01vars) group_vars <- factor_vars[nclass_factor >= 2 & nclass_factor <= 10 & nclass_factor < nrow(data())] group_list <- mklist(data_varStruct(), group_vars) except_vars <- factor_vars[nclass_factor > 10 | nclass_factor == 1 | nclass_factor == nrow(data())] ## non-normal: shapiro test f <- function(x) { if (diff(range(x, na.rm = T)) == 0) { return(F) } else { return(shapiro.test(x)$p.value <= 0.05) } } non_normal <- ifelse(nrow(data()) <= 3 | nrow(data()) >= 5000, rep(F, length(conti_vars)), sapply(conti_vars, function(x) { f(data()[[x]]) }) ) return(list( factor_vars = factor_vars, factor_list = factor_list, conti_vars = conti_vars, conti_list = conti_list, factor_01vars = factor_01vars, factor_01_list = factor_01_list, group_list = group_list, except_vars = except_vars, non_normal = non_normal )) }) out.tb1 <- callModule(tb1simple2, "tb1", data = data, matdata = matdata, data_label = data.label, data_varStruct = NULL, vlist = vlist, group_var = reactive(mat.info()$group_var) ) output$table1_original <- renderDT({ tb <- out.tb1()$original$table cap <- out.tb1()$original$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_ps <- renderDT({ tb <- out.tb1()$ps$table cap <- out.tb1()$ps$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_iptw <- renderDT({ tb <- out.tb1()$iptw$table cap <- out.tb1()$iptw$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) }
Table 1 module UI for propensity score analysis.
tb1simpleUI(id)tb1simpleUI(id)
id |
id |
tb1 module UI for propensity score analysis
Table 1 UI for propensity score analysis
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) library(haven) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile"), tb1simpleUI("tb1") ), mainPanel( DTOutput("table1_original"), DTOutput("table1_ps"), DTOutput("table1_iptw") ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") data <- reactive(mat.info()$data) matdata <- reactive(mat.info()$matdata) data.label <- reactive(mat.info()$data.label) vlist <- eventReactive(mat.info(), { mklist <- function(varlist, vars) { lapply( varlist, function(x) { inter <- intersect(x, vars) if (length(inter) == 1) { inter <- c(inter, "") } return(inter) } ) } factor_vars <- names(data())[data()[, lapply(.SD, class) %in% c("factor", "character")]] factor_list <- mklist(data_varStruct(), factor_vars) conti_vars <- setdiff(names(data()), c(factor_vars, "pscore", "iptw")) conti_list <- mklist(data_varStruct(), conti_vars) nclass_factor <- unlist(data()[, lapply(.SD, function(x) { length(unique(x)[!is.na(unique(x))]) }), .SDcols = factor_vars ]) class01_factor <- unlist(data()[, lapply(.SD, function(x) { identical(levels(x), c("0", "1")) }), .SDcols = factor_vars ]) validate( need(!is.null(class01_factor), "No categorical variables coded as 0, 1 in data") ) factor_01vars <- factor_vars[class01_factor] factor_01_list <- mklist(data_varStruct(), factor_01vars) group_vars <- factor_vars[nclass_factor >= 2 & nclass_factor <= 10 & nclass_factor < nrow(data())] group_list <- mklist(data_varStruct(), group_vars) except_vars <- factor_vars[nclass_factor > 10 | nclass_factor == 1 | nclass_factor == nrow(data())] ## non-normal: shapiro test f <- function(x) { if (diff(range(x, na.rm = T)) == 0) { return(F) } else { return(shapiro.test(x)$p.value <= 0.05) } } non_normal <- ifelse(nrow(data()) <= 3 | nrow(data()) >= 5000, rep(F, length(conti_vars)), sapply(conti_vars, function(x) { f(data()[[x]]) }) ) return(list( factor_vars = factor_vars, factor_list = factor_list, conti_vars = conti_vars, conti_list = conti_list, factor_01vars = factor_01vars, factor_01_list = factor_01_list, group_list = group_list, except_vars = except_vars, non_normal = non_normal )) }) out.tb1 <- callModule(tb1simple2, "tb1", data = data, matdata = matdata, data_label = data.label, data_varStruct = NULL, vlist = vlist, group_var = reactive(mat.info()$group_var) ) output$table1_original <- renderDT({ tb <- out.tb1()$original$table cap <- out.tb1()$original$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_ps <- renderDT({ tb <- out.tb1()$ps$table cap <- out.tb1()$ps$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_iptw <- renderDT({ tb <- out.tb1()$iptw$table cap <- out.tb1()$iptw$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) }library(shiny) library(DT) library(data.table) library(readxl) library(jstable) library(haven) library(survey) ui <- fluidPage( sidebarLayout( sidebarPanel( FilePsInput("datafile"), tb1simpleUI("tb1") ), mainPanel( DTOutput("table1_original"), DTOutput("table1_ps"), DTOutput("table1_iptw") ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") data <- reactive(mat.info()$data) matdata <- reactive(mat.info()$matdata) data.label <- reactive(mat.info()$data.label) vlist <- eventReactive(mat.info(), { mklist <- function(varlist, vars) { lapply( varlist, function(x) { inter <- intersect(x, vars) if (length(inter) == 1) { inter <- c(inter, "") } return(inter) } ) } factor_vars <- names(data())[data()[, lapply(.SD, class) %in% c("factor", "character")]] factor_list <- mklist(data_varStruct(), factor_vars) conti_vars <- setdiff(names(data()), c(factor_vars, "pscore", "iptw")) conti_list <- mklist(data_varStruct(), conti_vars) nclass_factor <- unlist(data()[, lapply(.SD, function(x) { length(unique(x)[!is.na(unique(x))]) }), .SDcols = factor_vars ]) class01_factor <- unlist(data()[, lapply(.SD, function(x) { identical(levels(x), c("0", "1")) }), .SDcols = factor_vars ]) validate( need(!is.null(class01_factor), "No categorical variables coded as 0, 1 in data") ) factor_01vars <- factor_vars[class01_factor] factor_01_list <- mklist(data_varStruct(), factor_01vars) group_vars <- factor_vars[nclass_factor >= 2 & nclass_factor <= 10 & nclass_factor < nrow(data())] group_list <- mklist(data_varStruct(), group_vars) except_vars <- factor_vars[nclass_factor > 10 | nclass_factor == 1 | nclass_factor == nrow(data())] ## non-normal: shapiro test f <- function(x) { if (diff(range(x, na.rm = T)) == 0) { return(F) } else { return(shapiro.test(x)$p.value <= 0.05) } } non_normal <- ifelse(nrow(data()) <= 3 | nrow(data()) >= 5000, rep(F, length(conti_vars)), sapply(conti_vars, function(x) { f(data()[[x]]) }) ) return(list( factor_vars = factor_vars, factor_list = factor_list, conti_vars = conti_vars, conti_list = conti_list, factor_01vars = factor_01vars, factor_01_list = factor_01_list, group_list = group_list, except_vars = except_vars, non_normal = non_normal )) }) out.tb1 <- callModule(tb1simple2, "tb1", data = data, matdata = matdata, data_label = data.label, data_varStruct = NULL, vlist = vlist, group_var = reactive(mat.info()$group_var) ) output$table1_original <- renderDT({ tb <- out.tb1()$original$table cap <- out.tb1()$original$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_ps <- renderDT({ tb <- out.tb1()$ps$table cap <- out.tb1()$ps$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) output$table1_iptw <- renderDT({ tb <- out.tb1()$iptw$table cap <- out.tb1()$iptw$caption out <- datatable(tb, rownames = T, extension = "Buttons", caption = cap) return(out) }) }
Opens a Shiny app that allows users to generate a Shiny project template.
templateGenerator()templateGenerator()
Shiny Gadget including Data, Label info, Table 1, Regression(linear, logistic), Basic plots
Shiny Gadget including Data, Label info, Table 1, Regression(linear, logistic), Basic plots
if (interactive()) { templateGenerator() }if (interactive()) { templateGenerator() }
extract AUC information from list of timeROChelper object.
timeROC_table(ListModel, dec.auc = 3, dec.p = 3)timeROC_table(ListModel, dec.auc = 3, dec.p = 3)
ListModel |
list of timeROChelper object |
dec.auc |
digits for AUC, Default: 3 |
dec.p |
digits for p value, Default: 3 |
extract AUC information from list of timeROChelper object.
table of AUC information
# library(survival) # list.timeROC <- lapply(list("age", c("age", "sex")), # function(x){ # timeROChelper("status", "time", x, t = 365, data = lung) # }) # timeROC_table(list.timeROC)# library(survival) # list.timeROC <- lapply(list("age", c("age", "sex")), # function(x){ # timeROChelper("status", "time", x, t = 365, data = lung) # }) # timeROC_table(list.timeROC)
Helper function for timerocModule
timeROChelper( var.event, var.time, vars.ind, t, data, design.survey = NULL, id.cluster = NULL )timeROChelper( var.event, var.time, vars.ind, t, data, design.survey = NULL, id.cluster = NULL )
var.event |
event |
var.time |
time |
vars.ind |
independent variable |
t |
time |
data |
data |
design.survey |
survey data, Default: NULL |
id.cluster |
cluster variable if marginal model, Default: NULL |
Helper function for timerocModule
timeROC and coxph object
coxph
svycoxph
predict
timeROC
# library(survival) # timeROChelper("status", "time", c("age", "sex"), t = 365, data = lung)# library(survival) # timeROChelper("status", "time", c("age", "sex"), t = 365, data = lung)
shiny module server for time-dependent roc analysis
shiny module server for time-dependent roc analysis- input number of model as integer
timerocModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL, iid = TRUE, NRIIDI = TRUE ) timerocModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL, iid = T, NRIIDI = T )timerocModule( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL, iid = TRUE, NRIIDI = TRUE ) timerocModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, id.cluster = NULL, iid = T, NRIIDI = T )
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 |
iid |
logical, get CI of AUC, Default: T |
NRIIDI |
logical, get NRI & IDI, Default: T |
shiny module server for time-dependent roc analysis
shiny module server for time dependent roc analysis- input number of model as integer
shiny module server for time-dependent roc analysis
shiny module server for time dependent roc analysis- input number of model as integer
quantile
setkey
data.table
rbindlist
quantile
setkey
data.table
rbindlist
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(timeROC) library(survIDINRI) ui <- fluidPage(sidebarLayout( sidebarPanel(timerocUI("timeroc")), mainPanel( plotOutput("plot_timeroc"), ggplotdownUI("timeroc"), DTOutput("table_timeroc") ) )) server <- function(input, output, session) { data <- reactive({ dt_data <- as.data.table(pbc) factor_vars <- names(dt_data)[sapply(dt_data, function(x){length(table(x))}) <= 6] dt_data[, (factor_vars) := lapply(.SD, factor), .SDcols = factor_vars] return(dt_data) }) data.label <- reactive({ jstable::mk.lev(data()) }) out_timeroc <- callModule( timerocModule, "timeroc", data = data, data_label = data.label, data_varStruct = NULL ) observe({ tb <- tryCatch(out_timeroc()$tb, error = function(e) NULL) print(tb) }) output$plot_timeroc <- renderPlot({ { print(out_timeroc()$plot) } }) output$table_timeroc <- renderDT({ datatable( out_timeroc()$tb, rownames = F, editable = F, extensions = "Buttons", caption = "ROC results", options = c(jstable::opt.tbreg("roctable"), list(scrollX = TRUE)) ) }) } library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(timeROC) library(survIDINRI) ui <- fluidPage(sidebarLayout( sidebarPanel(timerocUI("timeroc")), mainPanel( plotOutput("plot_timeroc"), ggplotdownUI("timeroc"), DTOutput("table_timeroc") ) )) server <- function(input, output, session) { data <- reactive({ dt_data <- as.data.table(pbc) factor_vars <- names(dt_data)[sapply(dt_data, function(x){length(table(x))}) <= 6] dt_data[, (factor_vars) := lapply(.SD, factor), .SDcols = factor_vars] return(dt_data) }) data.label <- reactive({ jstable::mk.lev(data()) }) out_timeroc <- callModule( timerocModule2, "timeroc", data = data, data_label = data.label, data_varStruct = NULL ) observe({ tb <- tryCatch(out_timeroc()$tb, error = function(e) NULL) print(tb) }) output$plot_timeroc <- renderPlot({ { print(out_timeroc()$plot) } }) output$table_timeroc <- renderDT({ datatable( out_timeroc()$tb, rownames = F, editable = F, extensions = "Buttons", caption = "ROC results", options = c(jstable::opt.tbreg("roctable"), list(scrollX = TRUE)) ) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(timeROC) library(survIDINRI) ui <- fluidPage(sidebarLayout( sidebarPanel(timerocUI("timeroc")), mainPanel( plotOutput("plot_timeroc"), ggplotdownUI("timeroc"), DTOutput("table_timeroc") ) )) server <- function(input, output, session) { data <- reactive({ dt_data <- as.data.table(pbc) factor_vars <- names(dt_data)[sapply(dt_data, function(x){length(table(x))}) <= 6] dt_data[, (factor_vars) := lapply(.SD, factor), .SDcols = factor_vars] return(dt_data) }) data.label <- reactive({ jstable::mk.lev(data()) }) out_timeroc <- callModule( timerocModule, "timeroc", data = data, data_label = data.label, data_varStruct = NULL ) observe({ tb <- tryCatch(out_timeroc()$tb, error = function(e) NULL) print(tb) }) output$plot_timeroc <- renderPlot({ { print(out_timeroc()$plot) } }) output$table_timeroc <- renderDT({ datatable( out_timeroc()$tb, rownames = F, editable = F, extensions = "Buttons", caption = "ROC results", options = c(jstable::opt.tbreg("roctable"), list(scrollX = TRUE)) ) }) } library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(timeROC) library(survIDINRI) ui <- fluidPage(sidebarLayout( sidebarPanel(timerocUI("timeroc")), mainPanel( plotOutput("plot_timeroc"), ggplotdownUI("timeroc"), DTOutput("table_timeroc") ) )) server <- function(input, output, session) { data <- reactive({ dt_data <- as.data.table(pbc) factor_vars <- names(dt_data)[sapply(dt_data, function(x){length(table(x))}) <= 6] dt_data[, (factor_vars) := lapply(.SD, factor), .SDcols = factor_vars] return(dt_data) }) data.label <- reactive({ jstable::mk.lev(data()) }) out_timeroc <- callModule( timerocModule2, "timeroc", data = data, data_label = data.label, data_varStruct = NULL ) observe({ tb <- tryCatch(out_timeroc()$tb, error = function(e) NULL) print(tb) }) output$plot_timeroc <- renderPlot({ { print(out_timeroc()$plot) } }) output$table_timeroc <- renderDT({ datatable( out_timeroc()$tb, rownames = F, editable = F, extensions = "Buttons", caption = "ROC results", options = c(jstable::opt.tbreg("roctable"), list(scrollX = TRUE)) ) }) }
Shiny module UI for time-dependent roc analysis
timerocUI(id)timerocUI(id)
id |
id |
Shiny module UI for time-dependent roc analysis
Shiny module UI for time-dependent roc analysis
library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(timeROC) library(survIDINRI) ui <- fluidPage( sidebarLayout( sidebarPanel( timerocUI("timeroc") ), mainPanel( plotOutput("plot_timeroc"), ggplotdownUI("timeroc"), DTOutput("table_timeroc") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- jstable::mk.lev(mtcars) out_timeroc <- callModule(timerocModule, "timeroc", data = data, data_label = data.label, data_varStruct = NULL ) output$plot_timeroc <- renderPlot({ print(out_timeroc()$plot) }) output$table_timeroc <- renderDT({ datatable(out_timeroc()$tb, rownames = F, editable = F, extensions = "Buttons", caption = "ROC results", options = c(jstable::opt.tbreg("roctable"), list(scrollX = TRUE)) ) }) }library(shiny) library(DT) library(data.table) library(jstable) library(ggplot2) library(timeROC) library(survIDINRI) ui <- fluidPage( sidebarLayout( sidebarPanel( timerocUI("timeroc") ), mainPanel( plotOutput("plot_timeroc"), ggplotdownUI("timeroc"), DTOutput("table_timeroc") ) ) ) server <- function(input, output, session) { data <- reactive(mtcars) data.label <- jstable::mk.lev(mtcars) out_timeroc <- callModule(timerocModule, "timeroc", data = data, data_label = data.label, data_varStruct = NULL ) output$plot_timeroc <- renderPlot({ print(out_timeroc()$plot) }) output$table_timeroc <- renderDT({ datatable(out_timeroc()$tb, rownames = F, editable = F, extensions = "Buttons", caption = "ROC results", options = c(jstable::opt.tbreg("roctable"), list(scrollX = TRUE)) ) }) }
Adds the custom 'style.css' file bundled with the jsmodule package to a Shiny UI. This allows consistent styling (e.g., bold navbar title, font tweaks, spacing) across all Shiny applications using this package.
use_jsmodule_style()use_jsmodule_style()
This function is meant to be used inside the UI of a Shiny app. It automatically locates and includes the 'style.css' file found in 'inst/assets/' of the jsmodule package installation.
An HTML '<link>' tag that loads the CSS into a Shiny UI
## Not run: use_jsmodule_style() ## End(Not run)## Not run: use_jsmodule_style() ## End(Not run)