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] |
Maintainer: | Jinseob Kim <[email protected]> |
License: | Apache License 2.0 |
Version: | 1.6.4 |
Built: | 2025-03-10 06:32:33 UTC |
Source: | https://github.com/jinseob2kim/jsmodule |
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)
Shiny module Server for file(csv or xlsx) upload.
csvFile(input, output, session, nfactor.limit = 20)
csvFile(input, output, session, nfactor.limit = 20)
input |
input |
output |
output |
session |
session |
nfactor.limit |
nfactor limit to include, Default: 20 |
Shiny module Server for file(csv or xlsx) upload.
Shiny module Server for file(csv or xlsx) upload.
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( csvFileInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(csvFile, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( csvFileInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(csvFile, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
Shiny module UI for file(csv or xlsx) upload.
csvFileInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
csvFileInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
id |
id |
label |
label, Default: 'csv/xlsx/sav/sas7bdat/dta file' |
Shiny module UI for file(csv or xlsx) upload.
Shiny module UI for file(csv or xlsx) upload.
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( csvFileInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(csvFile, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( csvFileInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(csvFile, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
Shiny module Server for file upload for propensity score matching.
FilePs(input, output, session, nfactor.limit = 20)
FilePs(input, output, session, nfactor.limit = 20)
input |
input |
output |
output |
session |
session |
nfactor.limit |
nfactor limit to include, Default: 20 |
Shiny module Server for file upload for propensity score matching.
Shiny module Server for file upload for propensity score matching.
library(shiny) library(DT) library(data.table) library(readxl) 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", width = "100%")) ) ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") output$data <- renderDT({ mat.info()$data }) output$matdata <- renderDT({ mat.info()$matdata }) output$label <- renderDT({ mat.info()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) 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", width = "100%")) ) ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") output$data <- renderDT({ mat.info()$data }) output$matdata <- renderDT({ mat.info()$matdata }) output$label <- renderDT({ mat.info()$label }) }
Shiny module UI for file upload for propensity score matching.
FilePsInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
FilePsInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
id |
id |
label |
label, Default: 'csv/xlsx/sav/sas7bdat file' |
Shiny module UI for file upload for propensity score matching.
Shiny module UI for file upload for propensity score matching.
library(shiny) library(DT) library(data.table) library(readxl) 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", width = "100%")) ) ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") output$data <- renderDT({ mat.info()$data }) output$matdata <- renderDT({ mat.info()$matdata }) output$label <- renderDT({ mat.info()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) 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", width = "100%")) ) ) ) ) server <- function(input, output, session) { mat.info <- callModule(FilePs, "datafile") output$data <- renderDT({ mat.info()$data }) output$matdata <- renderDT({ mat.info()$matdata }) output$label <- renderDT({ mat.info()$label }) }
File upload server module for repeated measure analysis.
FileRepeated(input, output, session, nfactor.limit = 20)
FileRepeated(input, output, session, nfactor.limit = 20)
input |
input |
output |
output |
session |
session |
nfactor.limit |
nfactor limit to include, Default: 20 |
File upload server module for repeated measure analysis.
File upload server module for repeated measure analysis.
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileRepeatedInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileRepeated, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileRepeatedInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileRepeated, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
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 |
id |
label |
label, Default: 'csv/xlsx/sav/sas7bdat/dta file' |
File upload UI for repeated measure analysis.
File upload UI for repeated measure analysis.
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileRepeatedInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileRepeated, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileRepeatedInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileRepeated, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
File upload server module for survey data analysis.
FileSurvey(input, output, session, nfactor.limit = 20)
FileSurvey(input, output, session, nfactor.limit = 20)
input |
input |
output |
output |
session |
session |
nfactor.limit |
nfactor limit to include, Default: 20 |
File upload server module for survey data analysis.
File upload server module for survey data analysis.
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileSurveyInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileSurvey, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileSurveyInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileSurvey, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
File upload UI for survey data analysis.
FileSurveyInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
FileSurveyInput(id, label = "Upload data (csv/xlsx/sav/sas7bdat/dta)")
id |
id |
label |
label, Default: 'csv/xlsx/sav/sas7bdat/dta file' |
File upload UI for survey data analysis.
File upload UI for survey data analysis.
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileSurveyInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileSurvey, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
library(shiny) library(DT) library(data.table) library(readxl) library(jstable) ui <- fluidPage( sidebarLayout( sidebarPanel( FileSurveyInput("datafile") ), mainPanel( tabsetPanel( type = "pills", tabPanel("Data", DTOutput("data")), tabPanel("Label", DTOutput("data_label", width = "100%")) ) ) ) ) server <- function(input, output, session) { data <- callModule(FileSurvey, "datafile") output$data <- renderDT({ data()$data }) output$label <- renderDT({ data()$label }) }
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 )
GEEModuleLinear( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, id.gee )
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 |
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 )
GEEModuleLogistic( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, id.gee )
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 |
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()) }) }
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 )
logisticModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 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 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 |
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 )
regressModule2( input, output, session, data, data_label, data_varStruct = NULL, nfactor.limit = 10, design.survey = NULL, default.unires = T, limit.unires = 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 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 |
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({ 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({ 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({ 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({ 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 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( 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( 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( 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( 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) }) }
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 = T, NRIIDI = T ) 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 = T, NRIIDI = T ) 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(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(timerocModule2, "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)) ) }) } 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(timerocModule2, "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)) ) }) }
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)) ) }) }