default filter out empty columns before analyses

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-01-20 12:00:50 +01:00
parent a6416f27ce
commit 27175d9655
No known key found for this signature in database
4 changed files with 28 additions and 7 deletions

View file

@ -53,7 +53,8 @@ Imports:
data.table,
apexcharter,
teal.modules.general,
esquisse
esquisse,
janitor
Suggests:
styler,
devtools,

View file

@ -3620,6 +3620,13 @@ ui_elements <- list(
# bslib::layout_sidebar(
# fillable = TRUE,
sidebar = bslib::sidebar(
shiny::sliderInput(inputId = "complete_cutoff",
label = "Cut-off for column completeness",
min = 0,
max = 1,
step = 0.1,
value = 0.5),
shiny::helpText("To improve speed, columns are removed before analysing data"),
shiny::radioButtons(
inputId = "all",
label = "Specify covariables",
@ -4134,7 +4141,8 @@ server <- function(input, output, session) {
shiny::reactive(rv$data),
shiny::reactive(rv$data_original),
data_filter(),
base_vars()
base_vars(),
input$complete_cutoff
),
{
rv$data_filtered <- data_filter()
@ -4143,7 +4151,8 @@ server <- function(input, output, session) {
REDCapCAST::fct_drop.data.frame() |>
(\(.x){
.x[base_vars()]
})()
})() |>
janitor::remove_empty(which = "cols",cutoff = input$complete_cutoff)
}
)
@ -4344,7 +4353,8 @@ server <- function(input, output, session) {
data_filter(),
input$strat_var,
input$include_vars,
input$add_p
input$add_p,
input$complete_cutoff
),
{
shiny::req(input$strat_var)

View file

@ -277,7 +277,8 @@ server <- function(input, output, session) {
shiny::reactive(rv$data),
shiny::reactive(rv$data_original),
data_filter(),
base_vars()
base_vars(),
input$complete_cutoff
),
{
rv$data_filtered <- data_filter()
@ -286,7 +287,8 @@ server <- function(input, output, session) {
REDCapCAST::fct_drop.data.frame() |>
(\(.x){
.x[base_vars()]
})()
})() |>
janitor::remove_empty(which = "cols",cutoff = input$complete_cutoff)
}
)
@ -487,7 +489,8 @@ server <- function(input, output, session) {
data_filter(),
input$strat_var,
input$include_vars,
input$add_p
input$add_p,
input$complete_cutoff
),
{
shiny::req(input$strat_var)

View file

@ -278,6 +278,13 @@ ui_elements <- list(
# bslib::layout_sidebar(
# fillable = TRUE,
sidebar = bslib::sidebar(
shiny::sliderInput(inputId = "complete_cutoff",
label = "Cut-off for column completeness",
min = 0,
max = 1,
step = 0.1,
value = 0.5),
shiny::helpText("To improve speed, columns are removed before analysing data"),
shiny::radioButtons(
inputId = "all",
label = "Specify covariables",