mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 09:59:39 +02:00
added option to choose var to stratify
This commit is contained in:
parent
6654425554
commit
c06d887c24
4 changed files with 22 additions and 4 deletions
|
@ -5,6 +5,6 @@ account: agdamsbo
|
||||||
server: shinyapps.io
|
server: shinyapps.io
|
||||||
hostUrl: https://api.shinyapps.io/v1
|
hostUrl: https://api.shinyapps.io/v1
|
||||||
appId: 13276335
|
appId: 13276335
|
||||||
bundleId: 9412301
|
bundleId: 9425248
|
||||||
url: https://agdamsbo.shinyapps.io/webResearch/
|
url: https://agdamsbo.shinyapps.io/webResearch/
|
||||||
version: 1
|
version: 1
|
||||||
|
|
|
@ -84,6 +84,16 @@ server <- function(input, output, session) {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
output$strat_var <- shiny::renderUI({
|
||||||
|
selectInput(
|
||||||
|
inputId = "strat_var",
|
||||||
|
selected = "none",
|
||||||
|
label = "Select variable to stratify baseline",
|
||||||
|
choices = c("none" ,colnames(ds())),
|
||||||
|
multiple = FALSE
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
output$factor_vars <- shiny::renderUI({
|
output$factor_vars <- shiny::renderUI({
|
||||||
selectizeInput(
|
selectizeInput(
|
||||||
inputId = "factor_vars",
|
inputId = "factor_vars",
|
||||||
|
@ -117,8 +127,8 @@ server <- function(input, output, session) {
|
||||||
|
|
||||||
data <- data |> factorize(vars = input$factor_vars)
|
data <- data |> factorize(vars = input$factor_vars)
|
||||||
|
|
||||||
if (is.factor(data[[input$outcome_var]])) {
|
if (is.factor(data[[input$strat_var]])) {
|
||||||
by.var <- input$outcome_var
|
by.var <- input$strat_var
|
||||||
} else {
|
} else {
|
||||||
by.var <- NULL
|
by.var <- NULL
|
||||||
}
|
}
|
||||||
|
@ -149,7 +159,14 @@ server <- function(input, output, session) {
|
||||||
list(
|
list(
|
||||||
by = by.var
|
by = by.var
|
||||||
)
|
)
|
||||||
),
|
) |>
|
||||||
|
(\(.x){
|
||||||
|
if (!is.null(by.var)){
|
||||||
|
.x |> gtsummary::add_overall()
|
||||||
|
} else {
|
||||||
|
.x
|
||||||
|
}
|
||||||
|
})(),
|
||||||
table2 = model |>
|
table2 = model |>
|
||||||
regression_table()
|
regression_table()
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
|
@ -128,6 +128,7 @@ ui <- bslib::page(
|
||||||
),
|
),
|
||||||
shiny::helpText(em("Please specify relevant columns from your data, and press 'Load data'")),
|
shiny::helpText(em("Please specify relevant columns from your data, and press 'Load data'")),
|
||||||
shiny::uiOutput("outcome_var"),
|
shiny::uiOutput("outcome_var"),
|
||||||
|
shiny::uiOutput("strat_var"),
|
||||||
shiny::radioButtons(
|
shiny::radioButtons(
|
||||||
inputId = "all",
|
inputId = "all",
|
||||||
label = "Specify covariables",
|
label = "Specify covariables",
|
||||||
|
|
Loading…
Add table
Reference in a new issue