diff --git a/CITATION.cff b/CITATION.cff index b3fc5ff0..2a3ec2e4 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -9,7 +9,7 @@ type: software license: AGPL-3.0-or-later title: 'FreesearchR: A free and open-source browser based data analysis tool for researchers with publication ready output' -version: 25.7.2 +version: 25.6.4 doi: 10.5281/zenodo.14527429 identifiers: - type: url diff --git a/DESCRIPTION b/DESCRIPTION index 002733c6..d602b0a3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: FreesearchR Title: A free and open-source browser based data analysis tool for researchers with publication ready output -Version: 25.7.2 +Version: 25.6.4 Authors@R: c( person("Andreas Gammelgaard", "Damsbo",email="agdamsbo@clin.au.dk", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7559-1154")), diff --git a/NAMESPACE b/NAMESPACE index de51a148..34c6092e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -17,7 +17,6 @@ export(clean_common_axis) export(clean_date) export(clean_sep) export(columnSelectInput) -export(compare_missings) export(contrast_text) export(create_baseline) export(create_column_server) diff --git a/NEWS.md b/NEWS.md index cd8a6859..fd591139 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,11 +1,3 @@ -# FreesearchR 25.7.2 - DEV - -- *FIX* refining hiding drop downs. All JavaScript is now in separate file. Coded with GAI help from claude.ai. - -# FreesearchR 25.7.1 - -- *NEW* UI overhaul and navigation update. The interface is simplified to clearly show the relationship between panels and sub-items by abandoning multiple levels on panel to instead show a drop-down menu. This also results in simplified sidebar menus with room to add more controls in the future. - # FreesearchR 25.6.4 The app is now also published as a docker container. See the README for instructions. It is mainly to use for hosting the app. Work is ongoing to publish a true standalone app, preferably for both Windows and MacOS. diff --git a/R/app_version.R b/R/app_version.R index 6a80b530..151c1165 100644 --- a/R/app_version.R +++ b/R/app_version.R @@ -1 +1 @@ -app_version <- function()'25.7.2' +app_version <- function()'25.6.4' diff --git a/R/data_plots.R b/R/data_plots.R index a751e609..bed502fc 100644 --- a/R/data_plots.R +++ b/R/data_plots.R @@ -11,96 +11,97 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) { ns <- shiny::NS(id) + # bslib::navset_bar( list( - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - multiple = FALSE, - bslib::accordion_panel( - title = "Creating plot", - icon = bsicons::bs_icon("graph-up"), - shiny::uiOutput(outputId = ns("primary")), - shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'), - shiny::tags$br(), - shiny::uiOutput(outputId = ns("type")), - shiny::uiOutput(outputId = ns("secondary")), - shiny::uiOutput(outputId = ns("tertiary")), - shiny::br(), - shiny::actionButton( - inputId = ns("act_plot"), - label = "Plot", - width = "100%", - icon = shiny::icon("palette"), - disabled = FALSE - ), - shiny::helpText('Adjust settings, then press "Plot".') + + # Sidebar with a slider input + sidebar = bslib::sidebar( + bslib::accordion( + multiple = FALSE, + bslib::accordion_panel( + title = "Creating plot", + icon = bsicons::bs_icon("graph-up"), + shiny::uiOutput(outputId = ns("primary")), + shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'), + shiny::tags$br(), + shiny::uiOutput(outputId = ns("type")), + shiny::uiOutput(outputId = ns("secondary")), + shiny::uiOutput(outputId = ns("tertiary")), + shiny::br(), + shiny::actionButton( + inputId = ns("act_plot"), + label = "Plot", + width = "100%", + icon = shiny::icon("palette"), + disabled = FALSE ), - bslib::accordion_panel( - title = "Download", - icon = bsicons::bs_icon("download"), - shinyWidgets::noUiSliderInput( - inputId = ns("height_slide"), - label = "Plot height (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color(), - inline = TRUE - ), - # shiny::numericInput( - # inputId = ns("height_numeric"), - # label = "Plot height (mm)", - # min = 50, - # max = 300, - # value = 100 - # ), - shinyWidgets::noUiSliderInput( - inputId = ns("width"), - label = "Plot width (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shiny::selectInput( - inputId = ns("plot_type"), - label = "File format", - choices = list( - "png", - "tiff", - "eps", - "pdf", - "jpeg", - "svg" - ) - ), - shiny::br(), - # Button - shiny::downloadButton( - outputId = ns("download_plot"), - label = "Download plot", - icon = shiny::icon("download") - ) - ) + shiny::helpText('Adjust settings, then press "Plot".') ), - shiny::p("We have collected a few notes on visualising data and details on the options included in FreesearchR:", shiny::tags$a( - href = "https://agdamsbo.github.io/FreesearchR/articles/visuals.html", - "View notes in new tab", - target = "_blank", - rel = "noopener noreferrer" - )) - ), + # bslib::accordion_panel( + # title = "Advanced", + # icon = bsicons::bs_icon("gear") + # ), + bslib::accordion_panel( + title = "Download", + icon = bsicons::bs_icon("download"), + shinyWidgets::noUiSliderInput( + inputId = ns("height_slide"), + label = "Plot height (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color(), + inline = TRUE + ), + # shiny::numericInput( + # inputId = ns("height_numeric"), + # label = "Plot height (mm)", + # min = 50, + # max = 300, + # value = 100 + # ), + shinyWidgets::noUiSliderInput( + inputId = ns("width"), + label = "Plot width (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shiny::selectInput( + inputId = ns("plot_type"), + label = "File format", + choices = list( + "png", + "tiff", + "eps", + "pdf", + "jpeg", + "svg" + ) + ), + shiny::br(), + # Button + shiny::downloadButton( + outputId = ns("download_plot"), + label = "Download plot", + icon = shiny::icon("download") + ) + ) + ) + ), + bslib::nav_panel( + title = tab_title, shiny::plotOutput(ns("plot"), height = "70vh"), shiny::tags$br(), shiny::tags$br(), shiny::htmlOutput(outputId = ns("code_plot")) ) ) - # ) } @@ -724,7 +725,6 @@ get_label <- function(data, var = NULL) { #' paste(sample(letters[1:10], 100, TRUE), collapse = "") |> line_break(force = TRUE) line_break <- function(data, lineLength = 20, force = FALSE) { if (isTRUE(force)) { - ## This eats some letters when splitting a sentence... ?? gsub(paste0("(.{1,", lineLength, "})(\\s|[[:alnum:]])"), "\\1\n", data) } else { paste(strwrap(data, lineLength), collapse = "\n") @@ -746,7 +746,7 @@ line_break <- function(data, lineLength = 20, force = FALSE) { wrap_plot_list <- function(data, tag_levels = NULL, title = NULL, - axis.font.family = NULL, + axis.font.family=NULL, ...) { if (ggplot2::is_ggplot(data[[1]])) { if (length(data) > 1) { diff --git a/R/hosted_version.R b/R/hosted_version.R index f6236bf0..17d0c52a 100644 --- a/R/hosted_version.R +++ b/R/hosted_version.R @@ -1 +1 @@ -hosted_version <- function()'v25.7.2-250703' +hosted_version <- function()'v25.6.4-250627' diff --git a/R/missings-module.R b/R/missings-module.R index c04a2561..71791ac6 100644 --- a/R/missings-module.R +++ b/R/missings-module.R @@ -44,7 +44,14 @@ data_missings_server <- function(id, tryCatch( { - out <- compare_missings(df_tbl,by_var) + if (!is.null(by_var) && by_var != "" && by_var %in% names(df_tbl)) { + df_tbl[[by_var]] <- ifelse(is.na(df_tbl[[by_var]]), "Missing", "Non-missing") + + out <- gtsummary::tbl_summary(df_tbl, by = by_var) |> + gtsummary::add_p() + } else { + out <- gtsummary::tbl_summary(df_tbl) + } }, error = function(err) { showNotification(paste0("Error: ", err), type = "err") @@ -122,22 +129,10 @@ missing_demo_app <- function() { missing_demo_app() -#' Pairwise comparison of missings across covariables -#' -#' @param data data frame -#' @param by_var variable to stratify by missingness -#' -#' @returns gtsummary list object -#' @export -#' -compare_missings <- function(data,by_var){ - if (!is.null(by_var) && by_var != "" && by_var %in% names(data)) { - data[[by_var]] <- ifelse(is.na(data[[by_var]]), "Missing", "Non-missing") - out <- gtsummary::tbl_summary(data, by = by_var) |> - gtsummary::add_p() - } else { - out <- gtsummary::tbl_summary(data) - } - out -} + + + + + + diff --git a/R/regression-module.R b/R/regression-module.R index 78f459d9..ee2eb9f0 100644 --- a/R/regression-module.R +++ b/R/regression-module.R @@ -44,173 +44,155 @@ regression_ui <- function(id, ...) { ns <- shiny::NS(id) shiny::tagList( - # title = "", - bslib::nav_panel( - title = "Regression table", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - shiny::uiOutput(outputId = ns("data_info"), inline = TRUE), - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_reg", - title = "Regression", - icon = bsicons::bs_icon("calculator"), - shiny::uiOutput(outputId = ns("outcome_var")), - # shiny::selectInput( - # inputId = "design", - # label = "Study design", - # selected = "no", - # inline = TRUE, - # choices = list( - # "Cross-sectional" = "cross-sectional" - # ) - # ), - shiny::uiOutput(outputId = ns("regression_type")), - shiny::radioButtons( - inputId = ns("all"), - label = "Specify covariables", - inline = TRUE, selected = 2, - choiceNames = c( - "Yes", - "No" - ), - choiceValues = c(1, 2) - ), - shiny::conditionalPanel( - condition = "input.all==1", - shiny::uiOutput(outputId = ns("regression_vars")), - shiny::helpText("If none are selected, all are included."), - shiny::tags$br(), - ns = ns - ), - bslib::input_task_button( - id = ns("load"), - label = "Analyse", - icon = bsicons::bs_icon("pencil"), - label_busy = "Working...", - icon_busy = fontawesome::fa_i("arrows-rotate", - class = "fa-spin", - "aria-hidden" = "true" - ), - type = "secondary", - auto_reset = TRUE - ), - shiny::helpText("Press 'Analyse' to create the regression model and after changing parameters."), - shiny::tags$br(), - shiny::radioButtons( - inputId = ns("add_regression_p"), - label = "Show p-value", - inline = TRUE, - selected = "yes", - choices = list( - "Yes" = "yes", - "No" = "no" - ) - ), - # shiny::tags$br(), - # shiny::radioButtons( - # inputId = ns("tbl_theme"), - # label = "Show p-value", - # inline = TRUE, - # selected = "jama", - # choices = list( - # "JAMA" = "jama", - # "Lancet" = "lancet", - # "NEJM" = "nejm" - # ) - # ), - shiny::tags$br() + title = "", + sidebar = bslib::sidebar( + shiny::uiOutput(outputId = ns("data_info"), inline = TRUE), + bslib::accordion( + open = "acc_reg", + multiple = FALSE, + bslib::accordion_panel( + value = "acc_reg", + title = "Regression", + icon = bsicons::bs_icon("calculator"), + shiny::uiOutput(outputId = ns("outcome_var")), + # shiny::selectInput( + # inputId = "design", + # label = "Study design", + # selected = "no", + # inline = TRUE, + # choices = list( + # "Cross-sectional" = "cross-sectional" + # ) + # ), + shiny::uiOutput(outputId = ns("regression_type")), + shiny::radioButtons( + inputId = ns("all"), + label = "Specify covariables", + inline = TRUE, selected = 2, + choiceNames = c( + "Yes", + "No" + ), + choiceValues = c(1, 2) + ), + shiny::conditionalPanel( + condition = "input.all==1", + shiny::uiOutput(outputId = ns("regression_vars")), + shiny::helpText("If none are selected, all are included."), + shiny::tags$br(), + ns = ns + ), + bslib::input_task_button( + id = ns("load"), + label = "Analyse", + icon = bsicons::bs_icon("pencil"), + label_busy = "Working...", + icon_busy = fontawesome::fa_i("arrows-rotate", + class = "fa-spin", + "aria-hidden" = "true" + ), + type = "secondary", + auto_reset = TRUE + ), + shiny::helpText("Press 'Analyse' to create the regression model and after changing parameters."), + shiny::tags$br(), + shiny::radioButtons( + inputId = ns("add_regression_p"), + label = "Show p-value", + inline = TRUE, + selected = "yes", + choices = list( + "Yes" = "yes", + "No" = "no" ) - ) + ), + # shiny::tags$br(), + # shiny::radioButtons( + # inputId = ns("tbl_theme"), + # label = "Show p-value", + # inline = TRUE, + # selected = "jama", + # choices = list( + # "JAMA" = "jama", + # "Lancet" = "lancet", + # "NEJM" = "nejm" + # ) + # ), + shiny::tags$br() ), - gt::gt_output(outputId = ns("table2")) - ) - ), - bslib::nav_panel( - title = "Coefficient plot", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - do.call( - bslib::accordion_panel, - c( - list( - value = "acc_plot", - title = "Coefficient plot", - icon = bsicons::bs_icon("bar-chart-steps"), - shiny::tags$br(), - shiny::uiOutput(outputId = ns("plot_model")) - ), - # plot_download_ui(ns("reg_plot_download")) - shiny::tagList( - shinyWidgets::noUiSliderInput( - inputId = ns("plot_height"), - label = "Plot height (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shinyWidgets::noUiSliderInput( - inputId = ns("plot_width"), - label = "Plot width (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shiny::selectInput( - inputId = ns("plot_type"), - label = "File format", - choices = list( - "png", - "tiff", - "eps", - "pdf", - "jpeg", - "svg" - ) - ), - shiny::br(), - # Button - shiny::downloadButton( - outputId = ns("download_plot"), - label = "Download plot", - icon = shiny::icon("download") - ) + do.call( + bslib::accordion_panel, + c( + list( + value = "acc_plot", + title = "Coefficient plot", + icon = bsicons::bs_icon("bar-chart-steps"), + shiny::tags$br(), + shiny::uiOutput(outputId = ns("plot_model")) + ), + # plot_download_ui(ns("reg_plot_download")) + shiny::tagList( + shinyWidgets::noUiSliderInput( + inputId = ns("plot_height"), + label = "Plot height (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shinyWidgets::noUiSliderInput( + inputId = ns("plot_width"), + label = "Plot width (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shiny::selectInput( + inputId = ns("plot_type"), + label = "File format", + choices = list( + "png", + "tiff", + "eps", + "pdf", + "jpeg", + "svg" ) + ), + shiny::br(), + # Button + shiny::downloadButton( + outputId = ns("download_plot"), + label = "Download plot", + icon = shiny::icon("download") ) ) ) ), - shiny::plotOutput(outputId = ns("regression_plot"), height = "80vh") + bslib::accordion_panel( + value = "acc_checks", + title = "Checks", + icon = bsicons::bs_icon("clipboard-check"), + shiny::uiOutput(outputId = ns("plot_checks")) + ) ) ), + bslib::nav_panel( + title = "Regression table", + gt::gt_output(outputId = ns("table2")) + ), + bslib::nav_panel( + title = "Coefficient plot", + shiny::plotOutput(outputId = ns("regression_plot"), height = "80vh") + ), bslib::nav_panel( title = "Model checks", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_checks", - title = "Checks", - icon = bsicons::bs_icon("clipboard-check"), - shiny::uiOutput(outputId = ns("plot_checks")) - ) - ) - ), - shiny::plotOutput(outputId = ns("check"), height = "90vh") - ) + shiny::plotOutput(outputId = ns("check"), height = "90vh") ) ) } diff --git a/R/sysdata.rda b/R/sysdata.rda index 252c2f42..ff32e166 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/SESSION.md b/SESSION.md index 1e585990..efcc1d93 100644 --- a/SESSION.md +++ b/SESSION.md @@ -11,11 +11,11 @@ |collate |en_US.UTF-8 | |ctype |en_US.UTF-8 | |tz |Europe/Copenhagen | -|date |2025-07-03 | +|date |2025-06-27 | |rstudio |2025.05.0+496 Mariposa Orchid (desktop) | |pandoc |3.6.4 @ /opt/homebrew/bin/ (via rmarkdown) | |quarto |1.7.30 @ /usr/local/bin/quarto | -|FreesearchR |25.7.2.250703 | +|FreesearchR |25.6.4.250627 | -------------------------------------------------------------------------------- @@ -26,8 +26,6 @@ |apexcharter |0.4.4 |2024-09-06 |CRAN (R 4.4.1) | |askpass |1.2.1 |2024-10-04 |CRAN (R 4.4.1) | |assertthat |0.2.1 |2019-03-21 |CRAN (R 4.4.1) | -|attachment |0.4.5 |2025-03-14 |CRAN (R 4.4.1) | -|attempt |0.3.1 |2020-05-03 |CRAN (R 4.4.1) | |backports |1.5.0 |2024-05-23 |CRAN (R 4.4.1) | |base64enc |0.1-3 |2015-07-28 |CRAN (R 4.4.1) | |bayestestR |0.15.3 |2025-04-28 |CRAN (R 4.4.1) | @@ -45,7 +43,6 @@ |cardx |0.2.4 |2025-04-12 |CRAN (R 4.4.1) | |caTools |1.18.3 |2024-09-04 |CRAN (R 4.4.1) | |cellranger |1.1.0 |2016-07-27 |CRAN (R 4.4.0) | -|cffr |1.2.0 |2025-01-25 |CRAN (R 4.4.1) | |checkmate |2.3.2 |2024-07-29 |CRAN (R 4.4.0) | |class |7.3-23 |2025-01-01 |CRAN (R 4.4.1) | |classInt |0.4-11 |2025-01-08 |CRAN (R 4.4.1) | @@ -55,9 +52,6 @@ |colorspace |2.1-1 |2024-07-26 |CRAN (R 4.4.1) | |commonmark |1.9.5 |2025-03-17 |CRAN (R 4.4.1) | |crayon |1.5.3 |2024-06-20 |CRAN (R 4.4.1) | -|credentials |2.0.2 |2024-10-04 |CRAN (R 4.4.1) | -|crosstalk |1.2.1 |2023-11-23 |CRAN (R 4.4.0) | -|curl |6.2.2 |2025-03-24 |CRAN (R 4.4.1) | |data.table |1.17.0 |2025-02-22 |CRAN (R 4.4.1) | |datamods |1.5.3 |2024-10-02 |CRAN (R 4.4.1) | |datawizard |1.0.2 |2025-03-24 |CRAN (R 4.4.1) | @@ -66,13 +60,11 @@ |devtools |2.4.5 |2022-10-11 |CRAN (R 4.4.0) | |DHARMa |0.4.7 |2024-10-18 |CRAN (R 4.4.1) | |digest |0.6.37 |2024-08-19 |CRAN (R 4.4.1) | -|dockerfiler |0.2.5 |2025-05-07 |CRAN (R 4.4.1) | |doParallel |1.0.17 |2022-02-07 |CRAN (R 4.4.0) | |dplyr |1.1.4 |2023-11-17 |CRAN (R 4.4.0) | |DT |0.33 |2024-04-04 |CRAN (R 4.4.0) | |e1071 |1.7-16 |2024-09-16 |CRAN (R 4.4.1) | |easystats |0.7.4 |2025-02-06 |CRAN (R 4.4.1) | -|effectsize |1.0.0 |2024-12-10 |CRAN (R 4.4.1) | |ellipsis |0.3.2 |2021-04-29 |CRAN (R 4.4.1) | |emmeans |1.11.1 |2025-05-04 |CRAN (R 4.4.1) | |esquisse |2.1.0 |2025-02-21 |CRAN (R 4.4.1) | @@ -90,19 +82,16 @@ |foreach |1.5.2 |2022-02-02 |CRAN (R 4.4.0) | |foreign |0.8-90 |2025-03-31 |CRAN (R 4.4.1) | |Formula |1.2-5 |2023-02-24 |CRAN (R 4.4.1) | -|FreesearchR |25.7.2 |NA |NA | +|FreesearchR |25.6.4 |NA |NA | |fs |1.6.6 |2025-04-12 |CRAN (R 4.4.1) | |gdtools |0.4.2 |2025-03-27 |CRAN (R 4.4.1) | |generics |0.1.3 |2022-07-05 |CRAN (R 4.4.1) | -|gert |2.1.5 |2025-03-25 |CRAN (R 4.4.1) | |ggalluvial |0.12.5 |2023-02-22 |CRAN (R 4.4.0) | |ggcorrplot |0.1.4.1 |2023-09-05 |CRAN (R 4.4.0) | |ggforce |0.4.2 |2024-02-19 |CRAN (R 4.4.0) | |ggplot2 |3.5.2 |2025-04-09 |CRAN (R 4.4.1) | |ggridges |0.5.6 |2024-01-23 |CRAN (R 4.4.0) | |ggstats |0.9.0 |2025-03-10 |CRAN (R 4.4.1) | -|gh |1.4.1 |2024-03-28 |CRAN (R 4.4.0) | -|gitcreds |0.1.2 |2022-09-08 |CRAN (R 4.4.1) | |glue |1.8.0 |2024-09-30 |CRAN (R 4.4.1) | |gridExtra |2.3 |2017-09-09 |CRAN (R 4.4.1) | |gt |1.0.0 |2025-04-05 |CRAN (R 4.4.1) | @@ -116,30 +105,24 @@ |htmltools |0.5.8.1 |2024-04-04 |CRAN (R 4.4.1) | |htmlwidgets |1.6.4 |2023-12-06 |CRAN (R 4.4.0) | |httpuv |1.6.16 |2025-04-16 |CRAN (R 4.4.1) | -|httr2 |1.1.2 |2025-03-26 |CRAN (R 4.4.1) | |IDEAFilter |0.2.0 |2024-04-15 |CRAN (R 4.4.0) | |insight |1.2.0 |2025-04-22 |CRAN (R 4.4.1) | |iterators |1.0.14 |2022-02-05 |CRAN (R 4.4.1) | |jquerylib |0.1.4 |2021-04-26 |CRAN (R 4.4.0) | |jsonlite |2.0.0 |2025-03-27 |CRAN (R 4.4.1) | -|jsonvalidate |1.5.0 |2025-02-07 |CRAN (R 4.4.1) | |KernSmooth |2.23-26 |2025-01-01 |CRAN (R 4.4.1) | |keyring |1.3.2 |2023-12-11 |CRAN (R 4.4.0) | |knitr |1.50 |2025-03-16 |CRAN (R 4.4.1) | |labeling |0.4.3 |2023-08-29 |CRAN (R 4.4.1) | -|labelled |2.14.0 |2025-01-08 |CRAN (R 4.4.1) | |later |1.4.2 |2025-04-08 |CRAN (R 4.4.1) | |lattice |0.22-7 |2025-04-02 |CRAN (R 4.4.1) | |lifecycle |1.0.4 |2023-11-07 |CRAN (R 4.4.1) | -|litedown |0.7 |2025-04-08 |CRAN (R 4.4.1) | |lme4 |1.1-37 |2025-03-26 |CRAN (R 4.4.1) | |lubridate |1.9.4 |2024-12-08 |CRAN (R 4.4.1) | |magrittr |2.0.3 |2022-03-30 |CRAN (R 4.4.1) | -|markdown |2.0 |2025-03-23 |CRAN (R 4.4.1) | |MASS |7.3-65 |2025-02-28 |CRAN (R 4.4.1) | |Matrix |1.7-3 |2025-03-11 |CRAN (R 4.4.1) | |memoise |2.0.1 |2021-11-26 |CRAN (R 4.4.0) | -|mgcv |1.9-3 |2025-04-04 |CRAN (R 4.4.1) | |mime |0.13 |2025-03-17 |CRAN (R 4.4.1) | |miniUI |0.1.2 |2025-04-17 |CRAN (R 4.4.1) | |minqa |1.2.8 |2024-08-17 |CRAN (R 4.4.1) | @@ -151,7 +134,6 @@ |opdisDownsampling |1.0.1 |2024-04-15 |CRAN (R 4.4.0) | |openssl |2.3.2 |2025-02-03 |CRAN (R 4.4.1) | |openxlsx2 |1.15 |2025-04-25 |CRAN (R 4.4.1) | -|pak |0.8.0.2 |2025-04-08 |CRAN (R 4.4.1) | |parameters |0.24.2 |2025-03-04 |CRAN (R 4.4.1) | |patchwork |1.3.0 |2024-09-16 |CRAN (R 4.4.1) | |pbmcapply |1.5.1 |2022-04-28 |CRAN (R 4.4.1) | @@ -180,7 +162,6 @@ |R6 |2.6.1 |2025-02-15 |CRAN (R 4.4.1) | |ragg |1.4.0 |2025-04-10 |CRAN (R 4.4.1) | |rankinPlot |1.1.0 |2023-01-30 |CRAN (R 4.4.0) | -|rappdirs |0.3.3 |2021-01-31 |CRAN (R 4.4.1) | |rbibutils |2.3 |2024-10-04 |CRAN (R 4.4.1) | |RColorBrewer |1.1-3 |2022-04-03 |CRAN (R 4.4.1) | |Rcpp |1.0.14 |2025-01-12 |CRAN (R 4.4.1) | @@ -211,16 +192,13 @@ |see |0.11.0 |2025-03-11 |CRAN (R 4.4.1) | |sessioninfo |1.2.3 |2025-02-05 |CRAN (R 4.4.1) | |shiny |1.10.0 |2024-12-14 |CRAN (R 4.4.1) | -|shiny2docker |0.0.2 |2025-02-09 |CRAN (R 4.4.1) | |shinybusy |0.3.3 |2024-03-09 |CRAN (R 4.4.0) | |shinyjs |2.1.0 |2021-12-23 |CRAN (R 4.4.0) | |shinyTime |1.0.3 |2022-08-19 |CRAN (R 4.4.0) | |shinyWidgets |0.9.0 |2025-02-21 |CRAN (R 4.4.1) | -|sourcetools |0.1.7-1 |2023-02-01 |CRAN (R 4.4.1) | |stringi |1.8.7 |2025-03-27 |CRAN (R 4.4.1) | |stringr |1.5.1 |2023-11-14 |CRAN (R 4.4.0) | |styler |1.10.3 |2024-04-07 |CRAN (R 4.4.0) | -|sys |3.4.3 |2024-10-04 |CRAN (R 4.4.1) | |systemfonts |1.2.2 |2025-04-04 |CRAN (R 4.4.1) | |testthat |3.2.3 |2025-01-13 |CRAN (R 4.4.1) | |textshaping |1.0.0 |2025-01-20 |CRAN (R 4.4.1) | @@ -235,9 +213,11 @@ |tzdb |0.5.0 |2025-03-15 |CRAN (R 4.4.1) | |urlchecker |1.0.1 |2021-11-30 |CRAN (R 4.4.1) | |usethis |3.1.0 |2024-11-26 |CRAN (R 4.4.1) | +|utf8 |1.2.4 |2023-10-22 |CRAN (R 4.4.1) | |uuid |1.2-1 |2024-07-29 |CRAN (R 4.4.1) | -|V8 |6.0.3 |2025-03-26 |CRAN (R 4.4.1) | |vctrs |0.6.5 |2023-12-01 |CRAN (R 4.4.0) | +|viridis |0.6.5 |2024-01-29 |CRAN (R 4.4.0) | +|viridisLite |0.4.2 |2023-05-02 |CRAN (R 4.4.1) | |vroom |1.6.5 |2023-12-05 |CRAN (R 4.4.0) | |withr |3.0.2 |2024-10-28 |CRAN (R 4.4.1) | |writexl |1.5.4 |2025-04-15 |CRAN (R 4.4.1) | @@ -245,5 +225,4 @@ |xml2 |1.3.8 |2025-03-14 |CRAN (R 4.4.1) | |xtable |1.8-4 |2019-04-21 |CRAN (R 4.4.1) | |yaml |2.3.10 |2024-07-26 |CRAN (R 4.4.1) | -|yesno |0.1.3 |2024-07-26 |CRAN (R 4.4.1) | |zip |2.3.2 |2025-02-01 |CRAN (R 4.4.1) | diff --git a/app_docker/app.R b/app_docker/app.R index b3b5a1bf..db2ebed5 100644 --- a/app_docker/app.R +++ b/app_docker/app.R @@ -5,7 +5,7 @@ ######## library(shiny) -library(shinyjs) +# library(shinyjs) # library(methods) # library(readr) # library(MASS) @@ -49,7 +49,7 @@ library(rlang) #### Current file: /Users/au301842/FreesearchR/R//app_version.R ######## -app_version <- function()'25.7.1' +app_version <- function()'25.6.3' ######## @@ -1611,96 +1611,97 @@ plot_histogram <- function(data, column=NULL, bins = 30, breaks = NULL, color = data_visuals_ui <- function(id, tab_title = "Plots", ...) { ns <- shiny::NS(id) + # bslib::navset_bar( list( - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - multiple = FALSE, - bslib::accordion_panel( - title = "Creating plot", - icon = bsicons::bs_icon("graph-up"), - shiny::uiOutput(outputId = ns("primary")), - shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'), - shiny::tags$br(), - shiny::uiOutput(outputId = ns("type")), - shiny::uiOutput(outputId = ns("secondary")), - shiny::uiOutput(outputId = ns("tertiary")), - shiny::br(), - shiny::actionButton( - inputId = ns("act_plot"), - label = "Plot", - width = "100%", - icon = shiny::icon("palette"), - disabled = FALSE - ), - shiny::helpText('Adjust settings, then press "Plot".') + + # Sidebar with a slider input + sidebar = bslib::sidebar( + bslib::accordion( + multiple = FALSE, + bslib::accordion_panel( + title = "Creating plot", + icon = bsicons::bs_icon("graph-up"), + shiny::uiOutput(outputId = ns("primary")), + shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'), + shiny::tags$br(), + shiny::uiOutput(outputId = ns("type")), + shiny::uiOutput(outputId = ns("secondary")), + shiny::uiOutput(outputId = ns("tertiary")), + shiny::br(), + shiny::actionButton( + inputId = ns("act_plot"), + label = "Plot", + width = "100%", + icon = shiny::icon("palette"), + disabled = FALSE ), - bslib::accordion_panel( - title = "Download", - icon = bsicons::bs_icon("download"), - shinyWidgets::noUiSliderInput( - inputId = ns("height_slide"), - label = "Plot height (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color(), - inline = TRUE - ), - # shiny::numericInput( - # inputId = ns("height_numeric"), - # label = "Plot height (mm)", - # min = 50, - # max = 300, - # value = 100 - # ), - shinyWidgets::noUiSliderInput( - inputId = ns("width"), - label = "Plot width (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shiny::selectInput( - inputId = ns("plot_type"), - label = "File format", - choices = list( - "png", - "tiff", - "eps", - "pdf", - "jpeg", - "svg" - ) - ), - shiny::br(), - # Button - shiny::downloadButton( - outputId = ns("download_plot"), - label = "Download plot", - icon = shiny::icon("download") - ) - ) + shiny::helpText('Adjust settings, then press "Plot".') ), - shiny::p("We have collected a few notes on visualising data and details on the options included in FreesearchR:", shiny::tags$a( - href = "https://agdamsbo.github.io/FreesearchR/articles/visuals.html", - "View notes in new tab", - target = "_blank", - rel = "noopener noreferrer" - )) - ), + # bslib::accordion_panel( + # title = "Advanced", + # icon = bsicons::bs_icon("gear") + # ), + bslib::accordion_panel( + title = "Download", + icon = bsicons::bs_icon("download"), + shinyWidgets::noUiSliderInput( + inputId = ns("height_slide"), + label = "Plot height (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color(), + inline = TRUE + ), + # shiny::numericInput( + # inputId = ns("height_numeric"), + # label = "Plot height (mm)", + # min = 50, + # max = 300, + # value = 100 + # ), + shinyWidgets::noUiSliderInput( + inputId = ns("width"), + label = "Plot width (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shiny::selectInput( + inputId = ns("plot_type"), + label = "File format", + choices = list( + "png", + "tiff", + "eps", + "pdf", + "jpeg", + "svg" + ) + ), + shiny::br(), + # Button + shiny::downloadButton( + outputId = ns("download_plot"), + label = "Download plot", + icon = shiny::icon("download") + ) + ) + ) + ), + bslib::nav_panel( + title = tab_title, shiny::plotOutput(ns("plot"), height = "70vh"), shiny::tags$br(), shiny::tags$br(), shiny::htmlOutput(outputId = ns("code_plot")) ) ) - # ) } @@ -1936,14 +1937,7 @@ data_visuals_server <- function(id, ) shiny::withProgress(message = "Drawing the plot. Hold tight for a moment..", { - rv$plot <- rlang::exec( - create_plot, - !!!append_list( - data(), - parameters, - "data" - ) - ) + rv$plot <- rlang::exec(create_plot, !!!append_list(data(), parameters, "data")) }) rv$code <- glue::glue("FreesearchR::create_plot(df,{list2str(parameters)})") @@ -1999,12 +1993,13 @@ data_visuals_server <- function(id, paste0("plot.", input$plot_type) }), content = function(file) { - if (inherits(rv$plot, "patchwork")) { + if (inherits(rv$plot,"patchwork")){ plot <- rv$plot - } else if (inherits(rv$plot, "ggplot")) { + } else if (inherits(rv$plot,"ggplot")){ plot <- rv$plot - } else { + }else { plot <- rv$plot[[1]] + } # browser() shiny::withProgress(message = "Drawing the plot. Hold on for a moment..", { @@ -2264,12 +2259,12 @@ create_plot <- function(data, type, pri, sec, ter = NULL, ...) { out <- do.call( type, - modifyList(parameters, list(data = data)) + modifyList(parameters,list(data=data)) ) - code <- rlang::call2(type, !!!parameters, .ns = "FreesearchR") + code <- rlang::call2(type,!!!parameters,.ns = "FreesearchR") - attr(out, "code") <- code + attr(out,"code") <- code out } @@ -2324,7 +2319,6 @@ get_label <- function(data, var = NULL) { #' paste(sample(letters[1:10], 100, TRUE), collapse = "") |> line_break(force = TRUE) line_break <- function(data, lineLength = 20, force = FALSE) { if (isTRUE(force)) { - ## This eats some letters when splitting a sentence... ?? gsub(paste0("(.{1,", lineLength, "})(\\s|[[:alnum:]])"), "\\1\n", data) } else { paste(strwrap(data, lineLength), collapse = "\n") @@ -2337,17 +2331,11 @@ line_break <- function(data, lineLength = 20, force = FALSE) { #' #' @param data list of ggplot2 objects #' @param tag_levels passed to patchwork::plot_annotation if given. Default is NULL -#' @param title panel title -#' @param ... ignored for argument overflow #' #' @returns list of ggplot2 objects #' @export #' -wrap_plot_list <- function(data, - tag_levels = NULL, - title = NULL, - axis.font.family = NULL, - ...) { +wrap_plot_list <- function(data, tag_levels = NULL) { if (ggplot2::is_ggplot(data[[1]])) { if (length(data) > 1) { out <- data |> @@ -2361,35 +2349,17 @@ wrap_plot_list <- function(data, } })() |> align_axes() |> - patchwork::wrap_plots( - guides = "collect", - axes = "collect", - axis_titles = "collect" - ) + patchwork::wrap_plots(guides = "collect", axes = "collect", axis_titles = "collect") if (!is.null(tag_levels)) { out <- out + patchwork::plot_annotation(tag_levels = tag_levels) } - if (!is.null(title)) { - out <- out + - patchwork::plot_annotation( - title = title, - theme = ggplot2::theme(plot.title = ggplot2::element_text(size = 25)) - ) - } } else { - out <- data[[1]] + out <- data } } else { cli::cli_abort("Can only wrap lists of {.cls ggplot} objects") } - - if (inherits(x = out, what = "patchwork")) { - out & - ggplot2::theme(axis.text = ggplot2::element_text(family = axis.font.family)) - } else { - out + - ggplot2::theme(axis.text = ggplot2::element_text(family = axis.font.family)) - } + out } @@ -4026,7 +3996,7 @@ simple_snake <- function(data){ #### Current file: /Users/au301842/FreesearchR/R//hosted_version.R ######## -hosted_version <- function()'v25.7.1-250703' +hosted_version <- function()'v25.6.3-250626' ######## @@ -4735,7 +4705,14 @@ data_missings_server <- function(id, tryCatch( { - out <- compare_missings(df_tbl,by_var) + if (!is.null(by_var) && by_var != "" && by_var %in% names(df_tbl)) { + df_tbl[[by_var]] <- ifelse(is.na(df_tbl[[by_var]]), "Missing", "Non-missing") + + out <- gtsummary::tbl_summary(df_tbl, by = by_var) |> + gtsummary::add_p() + } else { + out <- gtsummary::tbl_summary(df_tbl) + } }, error = function(err) { showNotification(paste0("Error: ", err), type = "err") @@ -4813,25 +4790,13 @@ missing_demo_app <- function() { missing_demo_app() -#' Pairwise comparison of missings across covariables -#' -#' @param data data frame -#' @param by_var variable to stratify by missingness -#' -#' @returns gtsummary list object -#' @export -#' -compare_missings <- function(data,by_var){ - if (!is.null(by_var) && by_var != "" && by_var %in% names(data)) { - data[[by_var]] <- ifelse(is.na(data[[by_var]]), "Missing", "Non-missing") - out <- gtsummary::tbl_summary(data, by = by_var) |> - gtsummary::add_p() - } else { - out <- gtsummary::tbl_summary(data) - } - out -} + + + + + + ######## @@ -4840,27 +4805,17 @@ compare_missings <- function(data,by_var){ #' Beautiful box plot(s) #' -#' @param data data frame -#' @param pri primary variable -#' @param sec secondary variable -#' @param ter tertiary variable -#' @param ... passed on to wrap_plot_list -#' #' @returns ggplot2 object #' @export #' #' @name data-plots #' #' @examples -#' mtcars |> plot_box(pri = "mpg", sec = "gear") -#' mtcars |> plot_box(pri = "mpg", sec="cyl") +#' mtcars |> plot_box(pri = "mpg", sec = "cyl", ter = "gear") #' mtcars |> #' default_parsing() |> #' plot_box(pri = "mpg", sec = "cyl", ter = "gear") -#' mtcars |> -#' default_parsing() |> -#' plot_box(pri = "mpg", sec = "cyl", ter = "gear",axis.font.family="mono") -plot_box <- function(data, pri, sec, ter = NULL,...) { +plot_box <- function(data, pri, sec, ter = NULL) { if (!is.null(ter)) { ds <- split(data, data[ter]) } else { @@ -4875,7 +4830,7 @@ plot_box <- function(data, pri, sec, ter = NULL,...) { ) }) - wrap_plot_list(out,title=glue::glue("Grouped by {get_label(data,ter)}"),...) + wrap_plot_list(out) } @@ -4891,7 +4846,6 @@ plot_box <- function(data, pri, sec, ter = NULL,...) { #' @examples #' mtcars |> plot_box_single("mpg") #' mtcars |> plot_box_single("mpg","cyl") -#' gtsummary::trial |> plot_box_single("age","trt") plot_box_single <- function(data, pri, sec=NULL, seed = 2103) { set.seed(seed) @@ -4907,8 +4861,6 @@ plot_box_single <- function(data, pri, sec=NULL, seed = 2103) { ggplot2::geom_boxplot(linewidth = 1.8, outliers = FALSE) + ## THis could be optional in future ggplot2::geom_jitter(color = "black", size = 2, alpha = 0.9, width = 0.1, height = .2) + - ggplot2::xlab(get_label(data,pri))+ - ggplot2::ylab(get_label(data,sec)) + ggplot2::coord_flip() + viridis::scale_fill_viridis(discrete = discrete, option = "D") + # ggplot2::theme_void() + @@ -5031,7 +4983,7 @@ plot_euler <- function(data, pri, sec, ter = NULL, seed = 2103) { }) # names(out) - wrap_plot_list(out,title=glue::glue("Grouped by {get_label(data,ter)}")) + wrap_plot_list(out) # patchwork::wrap_plots(out, guides = "collect") } @@ -5506,7 +5458,7 @@ plot_violin <- function(data, pri, sec, ter = NULL) { ) }) - wrap_plot_list(out,title=glue::glue("Grouped by {get_label(data,ter)}")) + wrap_plot_list(out) # patchwork::wrap_plots(out,guides = "collect") } @@ -7420,173 +7372,155 @@ regression_ui <- function(id, ...) { ns <- shiny::NS(id) shiny::tagList( - # title = "", - bslib::nav_panel( - title = "Regression table", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - shiny::uiOutput(outputId = ns("data_info"), inline = TRUE), - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_reg", - title = "Regression", - icon = bsicons::bs_icon("calculator"), - shiny::uiOutput(outputId = ns("outcome_var")), - # shiny::selectInput( - # inputId = "design", - # label = "Study design", - # selected = "no", - # inline = TRUE, - # choices = list( - # "Cross-sectional" = "cross-sectional" - # ) - # ), - shiny::uiOutput(outputId = ns("regression_type")), - shiny::radioButtons( - inputId = ns("all"), - label = "Specify covariables", - inline = TRUE, selected = 2, - choiceNames = c( - "Yes", - "No" - ), - choiceValues = c(1, 2) - ), - shiny::conditionalPanel( - condition = "input.all==1", - shiny::uiOutput(outputId = ns("regression_vars")), - shiny::helpText("If none are selected, all are included."), - shiny::tags$br(), - ns = ns - ), - bslib::input_task_button( - id = ns("load"), - label = "Analyse", - icon = bsicons::bs_icon("pencil"), - label_busy = "Working...", - icon_busy = fontawesome::fa_i("arrows-rotate", - class = "fa-spin", - "aria-hidden" = "true" - ), - type = "secondary", - auto_reset = TRUE - ), - shiny::helpText("Press 'Analyse' to create the regression model and after changing parameters."), - shiny::tags$br(), - shiny::radioButtons( - inputId = ns("add_regression_p"), - label = "Show p-value", - inline = TRUE, - selected = "yes", - choices = list( - "Yes" = "yes", - "No" = "no" - ) - ), - # shiny::tags$br(), - # shiny::radioButtons( - # inputId = ns("tbl_theme"), - # label = "Show p-value", - # inline = TRUE, - # selected = "jama", - # choices = list( - # "JAMA" = "jama", - # "Lancet" = "lancet", - # "NEJM" = "nejm" - # ) - # ), - shiny::tags$br() + title = "", + sidebar = bslib::sidebar( + shiny::uiOutput(outputId = ns("data_info"), inline = TRUE), + bslib::accordion( + open = "acc_reg", + multiple = FALSE, + bslib::accordion_panel( + value = "acc_reg", + title = "Regression", + icon = bsicons::bs_icon("calculator"), + shiny::uiOutput(outputId = ns("outcome_var")), + # shiny::selectInput( + # inputId = "design", + # label = "Study design", + # selected = "no", + # inline = TRUE, + # choices = list( + # "Cross-sectional" = "cross-sectional" + # ) + # ), + shiny::uiOutput(outputId = ns("regression_type")), + shiny::radioButtons( + inputId = ns("all"), + label = "Specify covariables", + inline = TRUE, selected = 2, + choiceNames = c( + "Yes", + "No" + ), + choiceValues = c(1, 2) + ), + shiny::conditionalPanel( + condition = "input.all==1", + shiny::uiOutput(outputId = ns("regression_vars")), + shiny::helpText("If none are selected, all are included."), + shiny::tags$br(), + ns = ns + ), + bslib::input_task_button( + id = ns("load"), + label = "Analyse", + icon = bsicons::bs_icon("pencil"), + label_busy = "Working...", + icon_busy = fontawesome::fa_i("arrows-rotate", + class = "fa-spin", + "aria-hidden" = "true" + ), + type = "secondary", + auto_reset = TRUE + ), + shiny::helpText("Press 'Analyse' to create the regression model and after changing parameters."), + shiny::tags$br(), + shiny::radioButtons( + inputId = ns("add_regression_p"), + label = "Show p-value", + inline = TRUE, + selected = "yes", + choices = list( + "Yes" = "yes", + "No" = "no" ) - ) + ), + # shiny::tags$br(), + # shiny::radioButtons( + # inputId = ns("tbl_theme"), + # label = "Show p-value", + # inline = TRUE, + # selected = "jama", + # choices = list( + # "JAMA" = "jama", + # "Lancet" = "lancet", + # "NEJM" = "nejm" + # ) + # ), + shiny::tags$br() ), - gt::gt_output(outputId = ns("table2")) - ) - ), - bslib::nav_panel( - title = "Coefficient plot", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - do.call( - bslib::accordion_panel, - c( - list( - value = "acc_plot", - title = "Coefficient plot", - icon = bsicons::bs_icon("bar-chart-steps"), - shiny::tags$br(), - shiny::uiOutput(outputId = ns("plot_model")) - ), - # plot_download_ui(ns("reg_plot_download")) - shiny::tagList( - shinyWidgets::noUiSliderInput( - inputId = ns("plot_height"), - label = "Plot height (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shinyWidgets::noUiSliderInput( - inputId = ns("plot_width"), - label = "Plot width (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shiny::selectInput( - inputId = ns("plot_type"), - label = "File format", - choices = list( - "png", - "tiff", - "eps", - "pdf", - "jpeg", - "svg" - ) - ), - shiny::br(), - # Button - shiny::downloadButton( - outputId = ns("download_plot"), - label = "Download plot", - icon = shiny::icon("download") - ) + do.call( + bslib::accordion_panel, + c( + list( + value = "acc_plot", + title = "Coefficient plot", + icon = bsicons::bs_icon("bar-chart-steps"), + shiny::tags$br(), + shiny::uiOutput(outputId = ns("plot_model")) + ), + # plot_download_ui(ns("reg_plot_download")) + shiny::tagList( + shinyWidgets::noUiSliderInput( + inputId = ns("plot_height"), + label = "Plot height (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shinyWidgets::noUiSliderInput( + inputId = ns("plot_width"), + label = "Plot width (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shiny::selectInput( + inputId = ns("plot_type"), + label = "File format", + choices = list( + "png", + "tiff", + "eps", + "pdf", + "jpeg", + "svg" ) + ), + shiny::br(), + # Button + shiny::downloadButton( + outputId = ns("download_plot"), + label = "Download plot", + icon = shiny::icon("download") ) ) ) ), - shiny::plotOutput(outputId = ns("regression_plot"), height = "80vh") + bslib::accordion_panel( + value = "acc_checks", + title = "Checks", + icon = bsicons::bs_icon("clipboard-check"), + shiny::uiOutput(outputId = ns("plot_checks")) + ) ) ), + bslib::nav_panel( + title = "Regression table", + gt::gt_output(outputId = ns("table2")) + ), + bslib::nav_panel( + title = "Coefficient plot", + shiny::plotOutput(outputId = ns("regression_plot"), height = "80vh") + ), bslib::nav_panel( title = "Model checks", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_checks", - title = "Checks", - icon = bsicons::bs_icon("clipboard-check"), - shiny::uiOutput(outputId = ns("plot_checks")) - ) - ) - ), - shiny::plotOutput(outputId = ns("check"), height = "90vh") - ) + shiny::plotOutput(outputId = ns("check"), height = "90vh") ) ) } @@ -9897,8 +9831,6 @@ ui_elements <- list( ############################################################################## "home" = bslib::nav_panel( title = "FreesearchR", - # title = shiny::div(htmltools::img(src="FreesearchR-logo-white-nobg-h80.png")), - icon = shiny::icon("house"), shiny::fluidRow( ## On building the dev-version for shinyapps.io, the dev_banner() is redefined ## Default just output "NULL" @@ -9910,7 +9842,8 @@ ui_elements <- list( shiny::markdown(readLines("www/intro.md")), shiny::column(width = 2) ) - ) + ), + icon = shiny::icon("home") ), ############################################################################## ######### @@ -9918,8 +9851,7 @@ ui_elements <- list( ######### ############################################################################## "import" = bslib::nav_panel( - title = "Get started", - icon = shiny::icon("upload"), + title = "Import", shiny::fluidRow( shiny::column(width = 2), shiny::column( @@ -9975,13 +9907,13 @@ ui_elements <- list( shiny::conditionalPanel( condition = "output.data_loaded == true", shiny::br(), - shiny::actionButton( - inputId = "modal_initial_view", - label = "Quick overview", - width = "100%", - icon = shiny::icon("binoculars"), - disabled = FALSE - ), + shiny::actionButton( + inputId = "modal_initial_view", + label = "Quick overview", + width = "100%", + icon = shiny::icon("binoculars"), + disabled = FALSE + ), shiny::br(), shiny::br(), shiny::h5("Select variables for final import"), @@ -10037,273 +9969,272 @@ ui_elements <- list( ######### Data overview panel ######### ############################################################################## - "prepare" = bslib::nav_menu( - title = "Prepare", - icon = shiny::icon("pen-to-square"), + "overview" = + # bslib::nav_panel_hidden( bslib::nav_panel( - title = "Overview", - icon = shiny::icon("eye"), - value = "nav_prepare_overview", - tags$h3("Overview and filtering"), - fluidRow( - shiny::column( - width = 9, - shiny::uiOutput(outputId = "data_info", inline = TRUE), + # value = "overview", + title = "Data", + bslib::navset_bar( + fillable = TRUE, + bslib::nav_panel( + title = "Overview", + tags$h3("Overview and filtering"), + fluidRow( + shiny::column( + width = 9, + shiny::uiOutput(outputId = "data_info", inline = TRUE), + shiny::tags$p( + "Below is a short summary table, on the right you can click to visualise data classes or browse data and create different data filters." + ) + ), + shiny::column( + width = 3, + shiny::actionButton( + inputId = "modal_visual_overview", + label = "Visual overview", + width = "100%", + disabled = TRUE + ), + shiny::br(), + shiny::br(), + shiny::actionButton( + inputId = "modal_browse", + label = "Browse data", + width = "100%", + disabled = TRUE + ), + shiny::br(), + shiny::br() + ) + ), + fluidRow( + shiny::column( + width = 9, + data_summary_ui(id = "data_summary"), + shiny::br(), + shiny::br(), + shiny::br(), + shiny::br(), + shiny::br() + ), + shiny::column( + width = 3, + # shiny::actionButton( + # inputId = "modal_missings", + # label = "Visual overview", + # width = "100%", + # disabled = TRUE + # ), + # shiny::br(), + # shiny::br(), + # shiny::actionButton( + # inputId = "modal_browse", + # label = "Browse data", + # width = "100%", + # disabled = TRUE + # ), + # shiny::br(), + # shiny::br(), + shiny::tags$h6("Filter data types"), + shiny::uiOutput( + outputId = "column_filter" + ), + shiny::helpText("Read more on how ", tags$a( + "data types", + href = "https://agdamsbo.github.io/FreesearchR/articles/data-types.html", + target = "_blank", + rel = "noopener noreferrer" + ), " are defined."), + shiny::br(), + shiny::br(), + shiny::tags$h6("Filter observations"), + shiny::tags$p("Filter on observation level"), + IDEAFilter::IDEAFilter_ui("data_filter"), + shiny::br(), + shiny::br() + ) + ), + shiny::br(), + shiny::br(), + # shiny::br(), + # shiny::br(), + shiny::br() + ), + bslib::nav_panel( + title = "Modify", + tags$h3("Subset, rename and convert variables"), + fluidRow( + shiny::column( + width = 9, + shiny::tags$p( + shiny::markdown("Below, are several options for simple data manipulation like update variables by renaming, creating new labels (for nicer tables in the report) and changing variable classes (numeric, factor/categorical etc.)."), + shiny::markdown("There are more advanced options to modify factor/categorical variables as well as create new factor from a continous variable or new variables with *R* code. At the bottom you can restore the original data."), + shiny::markdown("Please note that data modifications are applied before any filtering.") + ) + ) + ), + # shiny::tags$br(), + update_variables_ui("modal_variables"), + shiny::tags$br(), + shiny::tags$br(), + shiny::tags$h4("Advanced data manipulation"), + shiny::tags$p("Below options allow more advanced varaible manipulations."), + shiny::tags$br(), + shiny::tags$br(), + shiny::fluidRow( + shiny::column( + width = 4, + shiny::actionButton( + inputId = "modal_update", + label = "Reorder factor levels", + width = "100%" + ), + shiny::tags$br(), + shiny::helpText("Reorder the levels of factor/categorical variables."), + shiny::tags$br(), + shiny::tags$br() + ), + shiny::column( + width = 4, + shiny::actionButton( + inputId = "modal_cut", + label = "New factor", + width = "100%" + ), + shiny::tags$br(), + shiny::helpText("Create factor/categorical variable from a continous variable (number/date/time)."), + shiny::tags$br(), + shiny::tags$br() + ), + shiny::column( + width = 4, + shiny::actionButton( + inputId = "modal_column", + label = "New variable", + width = "100%" + ), + shiny::tags$br(), + shiny::helpText(shiny::markdown("Create a new variable/column based on an *R*-expression.")), + shiny::tags$br(), + shiny::tags$br() + ) + ), + tags$h4("Compare modified data to original"), + shiny::tags$br(), shiny::tags$p( - "Below is a short summary table, on the right you can click to visualise data classes or browse data and create different data filters." - ) - ), - shiny::column( - width = 3, + "Raw print of the original vs the modified data." + ), + shiny::tags$br(), + shiny::fluidRow( + shiny::column( + width = 6, + shiny::tags$b("Original data:"), + # verbatimTextOutput("original"), + shiny::verbatimTextOutput("original_str") + ), + shiny::column( + width = 6, + shiny::tags$b("Modified data:"), + # verbatimTextOutput("modified"), + shiny::verbatimTextOutput("modified_str") + ) + ), + shiny::tags$br(), shiny::actionButton( - inputId = "modal_visual_overview", - label = "Visual overview", - width = "100%", - disabled = TRUE + inputId = "data_reset", + label = "Restore original data", + width = "100%" ), - shiny::br(), - shiny::br(), - shiny::actionButton( - inputId = "modal_browse", - label = "Browse data", - width = "100%", - disabled = TRUE - ), - shiny::br(), - shiny::br() + shiny::tags$br(), + shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing."), + shiny::tags$br() ) - ), - fluidRow( - shiny::column( - width = 9, - data_summary_ui(id = "data_summary"), - shiny::br(), - shiny::br(), - shiny::br(), - shiny::br(), - shiny::br() - ), - shiny::column( - width = 3, - shiny::tags$h6("Filter data types"), - shiny::uiOutput( - outputId = "column_filter" - ), - shiny::helpText("Read more on how ", tags$a( - "data types", - href = "https://agdamsbo.github.io/FreesearchR/articles/data-types.html", - target = "_blank", - rel = "noopener noreferrer" - ), " are defined."), - shiny::br(), - shiny::br(), - shiny::tags$h6("Filter observations"), - shiny::tags$p("Filter on observation level"), - IDEAFilter::IDEAFilter_ui("data_filter"), - shiny::br(), - shiny::br() - ) - ), - shiny::br(), - shiny::br(), - shiny::br() + ) ), - bslib::nav_panel( - title = "Modify", - icon = shiny::icon("file-pen"), - tags$h3("Subset, rename and convert variables"), - fluidRow( - shiny::column( - width = 9, - shiny::tags$p( - shiny::markdown("Below, are several options for simple data manipulation like update variables by renaming, creating new labels (for nicer tables in the report) and changing variable classes (numeric, factor/categorical etc.)."), - shiny::markdown("There are more advanced options to modify factor/categorical variables as well as create new factor from a continous variable or new variables with *R* code. At the bottom you can restore the original data."), - shiny::markdown("Please note that data modifications are applied before any filtering.") - ) - ) - ), - update_variables_ui("modal_variables"), - shiny::tags$br(), - shiny::tags$br(), - shiny::tags$h4("Advanced data manipulation"), - shiny::tags$p("Below options allow more advanced varaible manipulations."), - shiny::tags$br(), - shiny::tags$br(), - shiny::fluidRow( - shiny::column( - width = 4, - shiny::actionButton( - inputId = "modal_update", - label = "Reorder factor levels", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText("Reorder the levels of factor/categorical variables."), - shiny::tags$br(), - shiny::tags$br() - ), - shiny::column( - width = 4, - shiny::actionButton( - inputId = "modal_cut", - label = "New factor", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText("Create factor/categorical variable from a continous variable (number/date/time)."), - shiny::tags$br(), - shiny::tags$br() - ), - shiny::column( - width = 4, - shiny::actionButton( - inputId = "modal_column", - label = "New variable", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText(shiny::markdown("Create a new variable/column based on an *R*-expression.")), - shiny::tags$br(), - shiny::tags$br() - ) - ), - tags$h4("Compare modified data to original"), - shiny::tags$br(), - shiny::tags$p( - "Raw print of the original vs the modified data." - ), - shiny::tags$br(), - shiny::fluidRow( - shiny::column( - width = 6, - shiny::tags$b("Original data:"), - shiny::verbatimTextOutput("original_str") - ), - shiny::column( - width = 6, - shiny::tags$b("Modified data:"), - shiny::verbatimTextOutput("modified_str") - ) - ), - shiny::tags$br(), - shiny::actionButton( - inputId = "data_reset", - label = "Restore original data", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing."), - shiny::tags$br() - ) - # ) - ), ############################################################################## ######### ######### Descriptive analyses panel ######### ############################################################################## "describe" = - bslib::nav_menu( + bslib::nav_panel( title = "Evaluate", - icon = shiny::icon("magnifying-glass-chart"), - # id = "navdescribe", - # bslib::navset_bar( - # title = "", - bslib::nav_panel( - title = "Characteristics", - icon = bsicons::bs_icon("table"), - bslib::layout_sidebar( - sidebar = bslib::sidebar( - shiny::uiOutput(outputId = "data_info_nochar", inline = TRUE), - bslib::accordion( - open = "acc_chars", - multiple = FALSE, - bslib::accordion_panel( - open = TRUE, - value = "acc_chars", - title = "Settings", - icon = bsicons::bs_icon("table"), - shiny::uiOutput("strat_var"), - shiny::helpText("Only factor/categorical variables are available for stratification. Go back to the 'Prepare' tab to reclass a variable if it's not on the list."), - shiny::conditionalPanel( - condition = "input.strat_var!='none'", - shiny::radioButtons( - inputId = "add_p", - label = "Compare strata?", - selected = "no", - inline = TRUE, - choices = list( - "No" = "no", - "Yes" = "yes" - ) - ), - shiny::helpText("Option to perform statistical comparisons between strata in baseline table.") + id = "navdescribe", + bslib::navset_bar( + title = "", + sidebar = bslib::sidebar( + shiny::uiOutput(outputId = "data_info_nochar", inline = TRUE), + bslib::accordion( + open = "acc_chars", + multiple = FALSE, + bslib::accordion_panel( + value = "acc_chars", + title = "Characteristics", + icon = bsicons::bs_icon("table"), + shiny::uiOutput("strat_var"), + shiny::helpText("Only factor/categorical variables are available for stratification. Go back to the 'Data' tab to reclass a variable if it's not on the list."), + shiny::conditionalPanel( + condition = "input.strat_var!='none'", + shiny::radioButtons( + inputId = "add_p", + label = "Compare strata?", + selected = "no", + inline = TRUE, + choices = list( + "No" = "no", + "Yes" = "yes" + ) ), - shiny::br(), - shiny::br(), - shiny::actionButton( - inputId = "act_eval", - label = "Evaluate", - width = "100%", - icon = shiny::icon("calculator"), - disabled = TRUE - ) + shiny::helpText("Option to perform statistical comparisons between strata in baseline table.") + ), + shiny::br(), + shiny::br(), + shiny::actionButton( + inputId = "act_eval", + label = "Evaluate", + width = "100%", + icon = shiny::icon("calculator"), + disabled = TRUE ) + ), + bslib::accordion_panel( + vlaue = "acc_cor", + title = "Correlations", + icon = bsicons::bs_icon("bounding-box"), + shiny::uiOutput("outcome_var_cor"), + shiny::helpText("To avoid evaluating the correlation of the outcome variable, this can be excluded from the plot or select 'none'."), + shiny::br(), + shinyWidgets::noUiSliderInput( + inputId = "cor_cutoff", + label = "Correlation cut-off", + min = 0, + max = 1, + step = .01, + value = .8, + format = shinyWidgets::wNumbFormat(decimals = 2), + color = datamods:::get_primary_color() + ), + shiny::helpText("Set the cut-off for considered 'highly correlated'.") + ), + bslib::accordion_panel( + vlaue = "acc_mis", + title = "Missings", + icon = bsicons::bs_icon("x-circle"), + shiny::uiOutput("missings_var"), + shiny::helpText("To consider if daata is missing by random, choose the outcome/dependent variable, if it has any missings to evaluate if there is a significant difference across other variables depending on missing data or not.") ) - ), + ) + ), + bslib::nav_panel( + title = "Characteristics", gt::gt_output(outputId = "table1") - ) - ), - bslib::nav_panel( - title = "Correlations", - icon = bsicons::bs_icon("bounding-box"), - bslib::layout_sidebar( - sidebar = bslib::sidebar( - shiny::uiOutput(outputId = "data_info_nochar", inline = TRUE), - bslib::accordion( - open = "acc_chars", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_cor", - title = "Correlations", - icon = bsicons::bs_icon("bounding-box"), - shiny::uiOutput("outcome_var_cor"), - shiny::helpText("To avoid evaluating the correlation of the outcome variable, this can be excluded from the plot or select 'none'."), - shiny::br(), - shinyWidgets::noUiSliderInput( - inputId = "cor_cutoff", - label = "Correlation cut-off", - min = 0, - max = 1, - step = .01, - value = .8, - format = shinyWidgets::wNumbFormat(decimals = 2), - color = datamods:::get_primary_color() - ), - shiny::helpText("Set the cut-off for considered 'highly correlated'.") - ) - ) - ), + ), + bslib::nav_panel( + title = "Correlations", data_correlations_ui(id = "correlations", height = 600) - ) - ), - bslib::nav_panel( - title = "Missings", - icon = bsicons::bs_icon("x-circle"), - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_chars", - multiple = FALSE, - bslib::accordion_panel( - vlaue = "acc_mis", - title = "Missings", - icon = bsicons::bs_icon("x-circle"), - shiny::uiOutput("missings_var"), - shiny::helpText("To consider if data is missing by random, choose the outcome/dependent variable, if it has any missings to evaluate if there is a significant difference across other variables depending on missing data or not.") - ) - ) - ), + ), + bslib::nav_panel( + title = "Missings", data_missings_ui(id = "missingness") ) ) @@ -10313,23 +10244,27 @@ ui_elements <- list( ######### Download panel ######### ############################################################################## - "visuals" = do.call( - bslib::nav_panel, - c( - list( - title = "Visuals", - icon = shiny::icon("chart-line"), - id = "navvisuals" - ), - data_visuals_ui("visuals") + "visuals" = bslib::nav_panel( + title = "Visuals", + id = "navvisuals", + do.call( + bslib::navset_bar, + c( + data_visuals_ui("visuals"), + shiny::tagList( + bslib::nav_spacer(), + bslib::nav_item( + # shiny::img(shiny::icon("book")), + shiny::tags$a( + href = "https://agdamsbo.github.io/FreesearchR/articles/visuals.html", + "Notes (external)", + target = "_blank", + rel = "noopener noreferrer" + ) + ) + ) + ) ) - # do.call( - # bslib::navset_bar, - # data_visuals_ui("visuals")#, - # c( - - # ) - # ) ), ############################################################################## ######### @@ -10339,10 +10274,9 @@ ui_elements <- list( "analyze" = bslib::nav_panel( title = "Regression", - icon = shiny::icon("calculator"), id = "navanalyses", do.call( - bslib::navset_card_tab, + bslib::navset_bar, regression_ui("regression") ) ), @@ -10354,7 +10288,6 @@ ui_elements <- list( "download" = bslib::nav_panel( title = "Download", - icon = shiny::icon("download"), id = "navdownload", shiny::fluidRow( shiny::column(width = 2), @@ -10480,25 +10413,9 @@ dark <- custom_theme( # https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/ ui <- bslib::page_fixed( - ## Code formatting dependencies prismDependencies, prismRDependency, - ## Version dependent header header_include(), - ## Automatically close drop-downs on navigation - ## Thanks to claude.ai - tags$script(" - $(document).on('shown.bs.tab', '#main_panel', function(e) { - // Close dropdown in this specific navset only - $('#main_panel .dropdown-menu').removeClass('show'); - $('#main_panel .dropdown-toggle').removeClass('show').attr('aria-expanded', 'false'); - - // THE BELOW DOES NOT WORK - // Close navbar collapse (burger menu) - $('#main_panel .navbar-collapse collapse').removeClass('show'); - $('#main_panel .navbar-toggle').removeClass('collapsed').attr('aria-expanded', 'false'); - }); - "), ## This adds the actual favicon ## png and ico versions are kept for compatibility shiny::tags$head(tags$link(rel = "shortcut icon", href = "favicon.svg")), @@ -10518,14 +10435,14 @@ ui <- bslib::page_fixed( id = "main_panel", ui_elements$home, ui_elements$import, - ui_elements$prepare, + ui_elements$overview, ui_elements$describe, ui_elements$visuals, ui_elements$analyze, ui_elements$download, bslib::nav_spacer(), - # ui_elements$feedback, - # ui_elements$docs, + ui_elements$feedback, + ui_elements$docs, fillable = FALSE, footer = shiny::tags$footer( style = "background-color: #14131326; padding: 4px; text-align: center; bottom: 0; width: 100%;", @@ -10535,7 +10452,7 @@ ui <- bslib::page_fixed( ), shiny::p( style = "margin: 1; color: #888;", - shiny::tags$a("Documentation", href = "https://agdamsbo.github.io/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", hosted_version(), " | ", shiny::tags$a("License: AGPLv3", href = "https://github.com/agdamsbo/FreesearchR/blob/main/LICENSE.md", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Source", href = "https://github.com/agdamsbo/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Share feedback", href = "https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8", target = "_blank", rel = "noopener noreferrer") + shiny::tags$a("Docs", href = "https://agdamsbo.github.io/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", hosted_version(), " | ", shiny::tags$a("License: AGPLv3", href = "https://github.com/agdamsbo/FreesearchR/blob/main/LICENSE.md", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Source", href = "https://github.com/agdamsbo/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Share feedback", href = "https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8", target = "_blank", rel = "noopener noreferrer") ), ) ) @@ -11247,7 +11164,7 @@ server <- function(input, output, session) { ############################################################################## shiny::observeEvent(input$act_start, { - bslib::nav_select(id = "main_panel", selected = "nav_prepare_overview") + bslib::nav_select(id = "main_panel", selected = "Data") }) ############################################################################## diff --git a/app_docker/www/FreesearchR-logo-black-nobg.png b/app_docker/www/FreesearchR-logo-black-nobg.png deleted file mode 100644 index 2b927071..00000000 Binary files a/app_docker/www/FreesearchR-logo-black-nobg.png and /dev/null differ diff --git a/app_docker/www/FreesearchR-logo-blue-nobg.png b/app_docker/www/FreesearchR-logo-blue-nobg.png deleted file mode 100644 index 0a0e5729..00000000 Binary files a/app_docker/www/FreesearchR-logo-blue-nobg.png and /dev/null differ diff --git a/app_docker/www/FreesearchR-logo-white-nobg-h80.png b/app_docker/www/FreesearchR-logo-white-nobg-h80.png deleted file mode 100644 index 2423010d..00000000 Binary files a/app_docker/www/FreesearchR-logo-white-nobg-h80.png and /dev/null differ diff --git a/app_docker/www/FreesearchR-logo-white-nobg.png b/app_docker/www/FreesearchR-logo-white-nobg.png deleted file mode 100644 index d9a68834..00000000 Binary files a/app_docker/www/FreesearchR-logo-white-nobg.png and /dev/null differ diff --git a/inst/apps/FreesearchR/app.R b/inst/apps/FreesearchR/app.R index a93a739c..28f5e3b6 100644 --- a/inst/apps/FreesearchR/app.R +++ b/inst/apps/FreesearchR/app.R @@ -1,11 +1,11 @@ ######## -#### Current file: /Users/au301842/FreesearchR/app/libs.R +#### Current file: /Users/au301842/FreesearchR/app/libs.R ######## library(shiny) -library(shinyjs) +# library(shinyjs) # library(methods) # library(readr) # library(MASS) @@ -40,20 +40,20 @@ library(rlang) ######## -#### Current file: /Users/au301842/FreesearchR/app/functions.R +#### Current file: /Users/au301842/FreesearchR/app/functions.R ######## ######## -#### Current file: /Users/au301842/FreesearchR/R//app_version.R +#### Current file: /Users/au301842/FreesearchR/R//app_version.R ######## -app_version <- function()'25.7.2' +app_version <- function()'25.6.4' ######## -#### Current file: /Users/au301842/FreesearchR/R//baseline_table.R +#### Current file: /Users/au301842/FreesearchR/R//baseline_table.R ######## #' Print a flexible baseline characteristics table @@ -138,7 +138,7 @@ create_baseline <- function(data, ..., by.var, add.p = FALSE, add.overall = FALS ######## -#### Current file: /Users/au301842/FreesearchR/R//contrast_text.R +#### Current file: /Users/au301842/FreesearchR/R//contrast_text.R ######## #' @title Contrast Text Color @@ -194,7 +194,7 @@ contrast_text <- function(background, ######## -#### Current file: /Users/au301842/FreesearchR/R//correlations-module.R +#### Current file: /Users/au301842/FreesearchR/R//correlations-module.R ######## #' Data correlations evaluation module @@ -339,7 +339,7 @@ sentence_paste <- function(data, and.str = "and") { ######## -#### Current file: /Users/au301842/FreesearchR/R//create-column-mod.R +#### Current file: /Users/au301842/FreesearchR/R//create-column-mod.R ######## #' @title Create new column @@ -782,7 +782,7 @@ make_choices_with_infos <- function(data) { ######## -#### Current file: /Users/au301842/FreesearchR/R//custom_SelectInput.R +#### Current file: /Users/au301842/FreesearchR/R//custom_SelectInput.R ######## #' A selectizeInput customized for data frames with column labels @@ -976,7 +976,7 @@ vectorSelectInput <- function(inputId, ######## -#### Current file: /Users/au301842/FreesearchR/R//cut-variable-dates.R +#### Current file: /Users/au301842/FreesearchR/R//cut-variable-dates.R ######## #' Extended cutting function with fall-back to the native base::cut @@ -1595,7 +1595,7 @@ plot_histogram <- function(data, column=NULL, bins = 30, breaks = NULL, color = ######## -#### Current file: /Users/au301842/FreesearchR/R//data_plots.R +#### Current file: /Users/au301842/FreesearchR/R//data_plots.R ######## # source(here::here("functions.R")) @@ -1611,96 +1611,97 @@ plot_histogram <- function(data, column=NULL, bins = 30, breaks = NULL, color = data_visuals_ui <- function(id, tab_title = "Plots", ...) { ns <- shiny::NS(id) + # bslib::navset_bar( list( - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - multiple = FALSE, - bslib::accordion_panel( - title = "Creating plot", - icon = bsicons::bs_icon("graph-up"), - shiny::uiOutput(outputId = ns("primary")), - shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'), - shiny::tags$br(), - shiny::uiOutput(outputId = ns("type")), - shiny::uiOutput(outputId = ns("secondary")), - shiny::uiOutput(outputId = ns("tertiary")), - shiny::br(), - shiny::actionButton( - inputId = ns("act_plot"), - label = "Plot", - width = "100%", - icon = shiny::icon("palette"), - disabled = FALSE - ), - shiny::helpText('Adjust settings, then press "Plot".') + + # Sidebar with a slider input + sidebar = bslib::sidebar( + bslib::accordion( + multiple = FALSE, + bslib::accordion_panel( + title = "Creating plot", + icon = bsicons::bs_icon("graph-up"), + shiny::uiOutput(outputId = ns("primary")), + shiny::helpText('Only non-text variables are available for plotting. Go the "Data" to reclass data to plot.'), + shiny::tags$br(), + shiny::uiOutput(outputId = ns("type")), + shiny::uiOutput(outputId = ns("secondary")), + shiny::uiOutput(outputId = ns("tertiary")), + shiny::br(), + shiny::actionButton( + inputId = ns("act_plot"), + label = "Plot", + width = "100%", + icon = shiny::icon("palette"), + disabled = FALSE ), - bslib::accordion_panel( - title = "Download", - icon = bsicons::bs_icon("download"), - shinyWidgets::noUiSliderInput( - inputId = ns("height_slide"), - label = "Plot height (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color(), - inline = TRUE - ), - # shiny::numericInput( - # inputId = ns("height_numeric"), - # label = "Plot height (mm)", - # min = 50, - # max = 300, - # value = 100 - # ), - shinyWidgets::noUiSliderInput( - inputId = ns("width"), - label = "Plot width (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shiny::selectInput( - inputId = ns("plot_type"), - label = "File format", - choices = list( - "png", - "tiff", - "eps", - "pdf", - "jpeg", - "svg" - ) - ), - shiny::br(), - # Button - shiny::downloadButton( - outputId = ns("download_plot"), - label = "Download plot", - icon = shiny::icon("download") - ) - ) + shiny::helpText('Adjust settings, then press "Plot".') ), - shiny::p("We have collected a few notes on visualising data and details on the options included in FreesearchR:", shiny::tags$a( - href = "https://agdamsbo.github.io/FreesearchR/articles/visuals.html", - "View notes in new tab", - target = "_blank", - rel = "noopener noreferrer" - )) - ), + # bslib::accordion_panel( + # title = "Advanced", + # icon = bsicons::bs_icon("gear") + # ), + bslib::accordion_panel( + title = "Download", + icon = bsicons::bs_icon("download"), + shinyWidgets::noUiSliderInput( + inputId = ns("height_slide"), + label = "Plot height (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color(), + inline = TRUE + ), + # shiny::numericInput( + # inputId = ns("height_numeric"), + # label = "Plot height (mm)", + # min = 50, + # max = 300, + # value = 100 + # ), + shinyWidgets::noUiSliderInput( + inputId = ns("width"), + label = "Plot width (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shiny::selectInput( + inputId = ns("plot_type"), + label = "File format", + choices = list( + "png", + "tiff", + "eps", + "pdf", + "jpeg", + "svg" + ) + ), + shiny::br(), + # Button + shiny::downloadButton( + outputId = ns("download_plot"), + label = "Download plot", + icon = shiny::icon("download") + ) + ) + ) + ), + bslib::nav_panel( + title = tab_title, shiny::plotOutput(ns("plot"), height = "70vh"), shiny::tags$br(), shiny::tags$br(), shiny::htmlOutput(outputId = ns("code_plot")) ) ) - # ) } @@ -2324,7 +2325,6 @@ get_label <- function(data, var = NULL) { #' paste(sample(letters[1:10], 100, TRUE), collapse = "") |> line_break(force = TRUE) line_break <- function(data, lineLength = 20, force = FALSE) { if (isTRUE(force)) { - ## This eats some letters when splitting a sentence... ?? gsub(paste0("(.{1,", lineLength, "})(\\s|[[:alnum:]])"), "\\1\n", data) } else { paste(strwrap(data, lineLength), collapse = "\n") @@ -2346,7 +2346,7 @@ line_break <- function(data, lineLength = 20, force = FALSE) { wrap_plot_list <- function(data, tag_levels = NULL, title = NULL, - axis.font.family = NULL, + axis.font.family=NULL, ...) { if (ggplot2::is_ggplot(data[[1]])) { if (length(data) > 1) { @@ -2445,7 +2445,7 @@ clean_common_axis <- function(p, axis) { ######## -#### Current file: /Users/au301842/FreesearchR/R//data-import.R +#### Current file: /Users/au301842/FreesearchR/R//data-import.R ######## data_import_ui <- function(id) { @@ -2602,7 +2602,7 @@ data_import_demo_app <- function() { ######## -#### Current file: /Users/au301842/FreesearchR/R//data-summary.R +#### Current file: /Users/au301842/FreesearchR/R//data-summary.R ######## #' Data summary module @@ -3000,7 +3000,7 @@ get_var_icon <- function(data,class.type=c("class","type")){ ######## -#### Current file: /Users/au301842/FreesearchR/R//datagrid-infos-mod.R +#### Current file: /Users/au301842/FreesearchR/R//datagrid-infos-mod.R ######## @@ -3349,7 +3349,7 @@ construct_col_summary <- function(data) { ######## -#### Current file: /Users/au301842/FreesearchR/R//helpers.R +#### Current file: /Users/au301842/FreesearchR/R//helpers.R ######## #' Wrapper function to get function from character vector referring to function from namespace. Passed to 'do.call()' @@ -4023,14 +4023,14 @@ simple_snake <- function(data){ ######## -#### Current file: /Users/au301842/FreesearchR/R//hosted_version.R +#### Current file: /Users/au301842/FreesearchR/R//hosted_version.R ######## -hosted_version <- function()'v25.7.2-250703' +hosted_version <- function()'v25.6.4-250627' ######## -#### Current file: /Users/au301842/FreesearchR/R//html_dependency_freesearchr.R +#### Current file: /Users/au301842/FreesearchR/R//html_dependency_freesearchr.R ######## html_dependency_FreesearchR <- function() { @@ -4045,7 +4045,7 @@ html_dependency_FreesearchR <- function() { ######## -#### Current file: /Users/au301842/FreesearchR/R//import-file-ext.R +#### Current file: /Users/au301842/FreesearchR/R//import-file-ext.R ######## #' @title Import data from a file @@ -4655,7 +4655,7 @@ import_file_demo_app <- function() { ######## -#### Current file: /Users/au301842/FreesearchR/R//launch_FreesearchR.R +#### Current file: /Users/au301842/FreesearchR/R//launch_FreesearchR.R ######## #' Easily launch the FreesearchR app @@ -4686,7 +4686,7 @@ launch_FreesearchR <- function(...){ ######## -#### Current file: /Users/au301842/FreesearchR/R//missings-module.R +#### Current file: /Users/au301842/FreesearchR/R//missings-module.R ######## #' Data correlations evaluation module @@ -4735,7 +4735,14 @@ data_missings_server <- function(id, tryCatch( { - out <- compare_missings(df_tbl,by_var) + if (!is.null(by_var) && by_var != "" && by_var %in% names(df_tbl)) { + df_tbl[[by_var]] <- ifelse(is.na(df_tbl[[by_var]]), "Missing", "Non-missing") + + out <- gtsummary::tbl_summary(df_tbl, by = by_var) |> + gtsummary::add_p() + } else { + out <- gtsummary::tbl_summary(df_tbl) + } }, error = function(err) { showNotification(paste0("Error: ", err), type = "err") @@ -4813,29 +4820,17 @@ missing_demo_app <- function() { missing_demo_app() -#' Pairwise comparison of missings across covariables -#' -#' @param data data frame -#' @param by_var variable to stratify by missingness -#' -#' @returns gtsummary list object -#' @export -#' -compare_missings <- function(data,by_var){ - if (!is.null(by_var) && by_var != "" && by_var %in% names(data)) { - data[[by_var]] <- ifelse(is.na(data[[by_var]]), "Missing", "Non-missing") - out <- gtsummary::tbl_summary(data, by = by_var) |> - gtsummary::add_p() - } else { - out <- gtsummary::tbl_summary(data) - } - out -} + + + + + + ######## -#### Current file: /Users/au301842/FreesearchR/R//plot_box.R +#### Current file: /Users/au301842/FreesearchR/R//plot_box.R ######## #' Beautiful box plot(s) @@ -4934,7 +4929,7 @@ plot_box_single <- function(data, pri, sec=NULL, seed = 2103) { ######## -#### Current file: /Users/au301842/FreesearchR/R//plot_euler.R +#### Current file: /Users/au301842/FreesearchR/R//plot_euler.R ######## #' Area proportional venn diagrams @@ -5075,7 +5070,7 @@ plot_euler_single <- function(data) { ######## -#### Current file: /Users/au301842/FreesearchR/R//plot_hbar.R +#### Current file: /Users/au301842/FreesearchR/R//plot_hbar.R ######## #' Nice horizontal stacked bars (Grotta bars) @@ -5175,7 +5170,7 @@ vertical_stacked_bars <- function(data, ######## -#### Current file: /Users/au301842/FreesearchR/R//plot_ridge.R +#### Current file: /Users/au301842/FreesearchR/R//plot_ridge.R ######## #' Plot nice ridge plot @@ -5209,7 +5204,7 @@ plot_ridge <- function(data, x, y, z = NULL, ...) { ######## -#### Current file: /Users/au301842/FreesearchR/R//plot_sankey.R +#### Current file: /Users/au301842/FreesearchR/R//plot_sankey.R ######## #' Readying data for sankey plot @@ -5442,7 +5437,7 @@ plot_sankey_single <- function(data, pri, sec, color.group = c("pri", "sec"), co ######## -#### Current file: /Users/au301842/FreesearchR/R//plot_scatter.R +#### Current file: /Users/au301842/FreesearchR/R//plot_scatter.R ######## #' Beautiful violin plot @@ -5477,7 +5472,7 @@ plot_scatter <- function(data, pri, sec, ter = NULL) { ######## -#### Current file: /Users/au301842/FreesearchR/R//plot_violin.R +#### Current file: /Users/au301842/FreesearchR/R//plot_violin.R ######## #' Beatiful violin plot @@ -5512,7 +5507,7 @@ plot_violin <- function(data, pri, sec, ter = NULL) { ######## -#### Current file: /Users/au301842/FreesearchR/R//plot-download-module.R +#### Current file: /Users/au301842/FreesearchR/R//plot-download-module.R ######## plot_download_ui <- regression_ui <- function(id, ...) { @@ -5593,7 +5588,7 @@ plot_download_server <- function(id, ######## -#### Current file: /Users/au301842/FreesearchR/R//redcap_read_shiny_module.R +#### Current file: /Users/au301842/FreesearchR/R//redcap_read_shiny_module.R ######## #' Shiny module to browser and export REDCap data @@ -6289,7 +6284,7 @@ redcap_demo_app <- function() { ######## -#### Current file: /Users/au301842/FreesearchR/R//regression_model.R +#### Current file: /Users/au301842/FreesearchR/R//regression_model.R ######## #' Create a regression model programatically @@ -7016,7 +7011,7 @@ regression_model_uv_list <- function(data, ######## -#### Current file: /Users/au301842/FreesearchR/R//regression_plot.R +#### Current file: /Users/au301842/FreesearchR/R//regression_plot.R ######## #' Regression coef plot from gtsummary. Slightly modified to pass on arguments @@ -7182,7 +7177,7 @@ symmetrical_scale_x_log10 <- function(plot, breaks = c(1, 2, 3, 5, 10), ...) { ######## -#### Current file: /Users/au301842/FreesearchR/R//regression_table.R +#### Current file: /Users/au301842/FreesearchR/R//regression_table.R ######## #' Create table of regression model @@ -7371,7 +7366,7 @@ tbl_merge <- function(data) { ######## -#### Current file: /Users/au301842/FreesearchR/R//regression-module.R +#### Current file: /Users/au301842/FreesearchR/R//regression-module.R ######## ### On rewriting this module @@ -7420,173 +7415,155 @@ regression_ui <- function(id, ...) { ns <- shiny::NS(id) shiny::tagList( - # title = "", - bslib::nav_panel( - title = "Regression table", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - shiny::uiOutput(outputId = ns("data_info"), inline = TRUE), - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_reg", - title = "Regression", - icon = bsicons::bs_icon("calculator"), - shiny::uiOutput(outputId = ns("outcome_var")), - # shiny::selectInput( - # inputId = "design", - # label = "Study design", - # selected = "no", - # inline = TRUE, - # choices = list( - # "Cross-sectional" = "cross-sectional" - # ) - # ), - shiny::uiOutput(outputId = ns("regression_type")), - shiny::radioButtons( - inputId = ns("all"), - label = "Specify covariables", - inline = TRUE, selected = 2, - choiceNames = c( - "Yes", - "No" - ), - choiceValues = c(1, 2) - ), - shiny::conditionalPanel( - condition = "input.all==1", - shiny::uiOutput(outputId = ns("regression_vars")), - shiny::helpText("If none are selected, all are included."), - shiny::tags$br(), - ns = ns - ), - bslib::input_task_button( - id = ns("load"), - label = "Analyse", - icon = bsicons::bs_icon("pencil"), - label_busy = "Working...", - icon_busy = fontawesome::fa_i("arrows-rotate", - class = "fa-spin", - "aria-hidden" = "true" - ), - type = "secondary", - auto_reset = TRUE - ), - shiny::helpText("Press 'Analyse' to create the regression model and after changing parameters."), - shiny::tags$br(), - shiny::radioButtons( - inputId = ns("add_regression_p"), - label = "Show p-value", - inline = TRUE, - selected = "yes", - choices = list( - "Yes" = "yes", - "No" = "no" - ) - ), - # shiny::tags$br(), - # shiny::radioButtons( - # inputId = ns("tbl_theme"), - # label = "Show p-value", - # inline = TRUE, - # selected = "jama", - # choices = list( - # "JAMA" = "jama", - # "Lancet" = "lancet", - # "NEJM" = "nejm" - # ) - # ), - shiny::tags$br() + title = "", + sidebar = bslib::sidebar( + shiny::uiOutput(outputId = ns("data_info"), inline = TRUE), + bslib::accordion( + open = "acc_reg", + multiple = FALSE, + bslib::accordion_panel( + value = "acc_reg", + title = "Regression", + icon = bsicons::bs_icon("calculator"), + shiny::uiOutput(outputId = ns("outcome_var")), + # shiny::selectInput( + # inputId = "design", + # label = "Study design", + # selected = "no", + # inline = TRUE, + # choices = list( + # "Cross-sectional" = "cross-sectional" + # ) + # ), + shiny::uiOutput(outputId = ns("regression_type")), + shiny::radioButtons( + inputId = ns("all"), + label = "Specify covariables", + inline = TRUE, selected = 2, + choiceNames = c( + "Yes", + "No" + ), + choiceValues = c(1, 2) + ), + shiny::conditionalPanel( + condition = "input.all==1", + shiny::uiOutput(outputId = ns("regression_vars")), + shiny::helpText("If none are selected, all are included."), + shiny::tags$br(), + ns = ns + ), + bslib::input_task_button( + id = ns("load"), + label = "Analyse", + icon = bsicons::bs_icon("pencil"), + label_busy = "Working...", + icon_busy = fontawesome::fa_i("arrows-rotate", + class = "fa-spin", + "aria-hidden" = "true" + ), + type = "secondary", + auto_reset = TRUE + ), + shiny::helpText("Press 'Analyse' to create the regression model and after changing parameters."), + shiny::tags$br(), + shiny::radioButtons( + inputId = ns("add_regression_p"), + label = "Show p-value", + inline = TRUE, + selected = "yes", + choices = list( + "Yes" = "yes", + "No" = "no" ) - ) + ), + # shiny::tags$br(), + # shiny::radioButtons( + # inputId = ns("tbl_theme"), + # label = "Show p-value", + # inline = TRUE, + # selected = "jama", + # choices = list( + # "JAMA" = "jama", + # "Lancet" = "lancet", + # "NEJM" = "nejm" + # ) + # ), + shiny::tags$br() ), - gt::gt_output(outputId = ns("table2")) - ) - ), - bslib::nav_panel( - title = "Coefficient plot", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - do.call( - bslib::accordion_panel, - c( - list( - value = "acc_plot", - title = "Coefficient plot", - icon = bsicons::bs_icon("bar-chart-steps"), - shiny::tags$br(), - shiny::uiOutput(outputId = ns("plot_model")) - ), - # plot_download_ui(ns("reg_plot_download")) - shiny::tagList( - shinyWidgets::noUiSliderInput( - inputId = ns("plot_height"), - label = "Plot height (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shinyWidgets::noUiSliderInput( - inputId = ns("plot_width"), - label = "Plot width (mm)", - min = 50, - max = 300, - value = 100, - step = 1, - format = shinyWidgets::wNumbFormat(decimals = 0), - color = datamods:::get_primary_color() - ), - shiny::selectInput( - inputId = ns("plot_type"), - label = "File format", - choices = list( - "png", - "tiff", - "eps", - "pdf", - "jpeg", - "svg" - ) - ), - shiny::br(), - # Button - shiny::downloadButton( - outputId = ns("download_plot"), - label = "Download plot", - icon = shiny::icon("download") - ) + do.call( + bslib::accordion_panel, + c( + list( + value = "acc_plot", + title = "Coefficient plot", + icon = bsicons::bs_icon("bar-chart-steps"), + shiny::tags$br(), + shiny::uiOutput(outputId = ns("plot_model")) + ), + # plot_download_ui(ns("reg_plot_download")) + shiny::tagList( + shinyWidgets::noUiSliderInput( + inputId = ns("plot_height"), + label = "Plot height (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shinyWidgets::noUiSliderInput( + inputId = ns("plot_width"), + label = "Plot width (mm)", + min = 50, + max = 300, + value = 100, + step = 1, + format = shinyWidgets::wNumbFormat(decimals = 0), + color = datamods:::get_primary_color() + ), + shiny::selectInput( + inputId = ns("plot_type"), + label = "File format", + choices = list( + "png", + "tiff", + "eps", + "pdf", + "jpeg", + "svg" ) + ), + shiny::br(), + # Button + shiny::downloadButton( + outputId = ns("download_plot"), + label = "Download plot", + icon = shiny::icon("download") ) ) ) ), - shiny::plotOutput(outputId = ns("regression_plot"), height = "80vh") + bslib::accordion_panel( + value = "acc_checks", + title = "Checks", + icon = bsicons::bs_icon("clipboard-check"), + shiny::uiOutput(outputId = ns("plot_checks")) + ) ) ), + bslib::nav_panel( + title = "Regression table", + gt::gt_output(outputId = ns("table2")) + ), + bslib::nav_panel( + title = "Coefficient plot", + shiny::plotOutput(outputId = ns("regression_plot"), height = "80vh") + ), bslib::nav_panel( title = "Model checks", - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_reg", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_checks", - title = "Checks", - icon = bsicons::bs_icon("clipboard-check"), - shiny::uiOutput(outputId = ns("plot_checks")) - ) - ) - ), - shiny::plotOutput(outputId = ns("check"), height = "90vh") - ) + shiny::plotOutput(outputId = ns("check"), height = "90vh") ) ) } @@ -8059,7 +8036,7 @@ regression_server <- function(id, ######## -#### Current file: /Users/au301842/FreesearchR/R//report.R +#### Current file: /Users/au301842/FreesearchR/R//report.R ######## #' Split vector by an index and embed addition @@ -8147,7 +8124,7 @@ modify_qmd <- function(file, format) { ######## -#### Current file: /Users/au301842/FreesearchR/R//syntax_highlight.R +#### Current file: /Users/au301842/FreesearchR/R//syntax_highlight.R ######## ## Inpiration: @@ -8178,7 +8155,7 @@ html_code_wrap <- function(string,lang="r"){ ######## -#### Current file: /Users/au301842/FreesearchR/R//theme.R +#### Current file: /Users/au301842/FreesearchR/R//theme.R ######## #' Custom theme based on unity @@ -8297,7 +8274,7 @@ gg_theme_export <- function() { ######## -#### Current file: /Users/au301842/FreesearchR/R//update-factor-ext.R +#### Current file: /Users/au301842/FreesearchR/R//update-factor-ext.R ######## @@ -8594,7 +8571,7 @@ winbox_update_factor <- function(id, ######## -#### Current file: /Users/au301842/FreesearchR/R//update-variables-ext.R +#### Current file: /Users/au301842/FreesearchR/R//update-variables-ext.R ######## #' Select, rename and convert variables @@ -9406,7 +9383,7 @@ clean_date <- function(data) { ######## -#### Current file: /Users/au301842/FreesearchR/R//visual_summary.R +#### Current file: /Users/au301842/FreesearchR/R//visual_summary.R ######## #' Data correlations evaluation module @@ -9703,7 +9680,7 @@ unique_short <- function(data, max = 15) { ######## -#### Current file: /Users/au301842/FreesearchR/R//wide2long.R +#### Current file: /Users/au301842/FreesearchR/R//wide2long.R ######## #' Alternative pivoting method for easily pivoting based on name pattern @@ -9862,18 +9839,17 @@ grepl_fix <- function(data, pattern, type = c("prefix", "infix", "suffix")) { ######## -#### Current file: /Users/au301842/FreesearchR/dev/header_include.R +#### Current file: /Users/au301842/FreesearchR/dev/header_include.R ######## header_include <- function(){ shiny::tags$head( - tags$link(rel = "stylesheet", type = "text/css", href = "style.css"), - tags$script(src="scripts.js")) + tags$link(rel = "stylesheet", type = "text/css", href = "style.css")) } ######## -#### Current file: /Users/au301842/FreesearchR/dev/dev_banner.R +#### Current file: /Users/au301842/FreesearchR/dev/dev_banner.R ######## dev_banner <- function(){ @@ -9882,7 +9858,7 @@ dev_banner <- function(){ ######## -#### Current file: /Users/au301842/FreesearchR/app/ui.R +#### Current file: /Users/au301842/FreesearchR/app/ui.R ######## # ns <- NS(id) @@ -9897,8 +9873,6 @@ ui_elements <- list( ############################################################################## "home" = bslib::nav_panel( title = "FreesearchR", - # title = shiny::div(htmltools::img(src="FreesearchR-logo-white-nobg-h80.png")), - icon = shiny::icon("house"), shiny::fluidRow( ## On building the dev-version for shinyapps.io, the dev_banner() is redefined ## Default just output "NULL" @@ -9910,7 +9884,8 @@ ui_elements <- list( shiny::markdown(readLines("www/intro.md")), shiny::column(width = 2) ) - ) + ), + icon = shiny::icon("home") ), ############################################################################## ######### @@ -9918,8 +9893,7 @@ ui_elements <- list( ######### ############################################################################## "import" = bslib::nav_panel( - title = "Get started", - icon = shiny::icon("play"), + title = "Import", shiny::fluidRow( shiny::column(width = 2), shiny::column( @@ -9975,13 +9949,13 @@ ui_elements <- list( shiny::conditionalPanel( condition = "output.data_loaded == true", shiny::br(), - shiny::actionButton( - inputId = "modal_initial_view", - label = "Quick overview", - width = "100%", - icon = shiny::icon("binoculars"), - disabled = FALSE - ), + shiny::actionButton( + inputId = "modal_initial_view", + label = "Quick overview", + width = "100%", + icon = shiny::icon("binoculars"), + disabled = FALSE + ), shiny::br(), shiny::br(), shiny::h5("Select variables for final import"), @@ -10037,273 +10011,272 @@ ui_elements <- list( ######### Data overview panel ######### ############################################################################## - "prepare" = bslib::nav_menu( - title = "Prepare", - icon = shiny::icon("pen-to-square"), + "overview" = + # bslib::nav_panel_hidden( bslib::nav_panel( - title = "Overview", - icon = shiny::icon("eye"), - value = "nav_prepare_overview", - tags$h3("Overview and filtering"), - fluidRow( - shiny::column( - width = 9, - shiny::uiOutput(outputId = "data_info", inline = TRUE), + # value = "overview", + title = "Data", + bslib::navset_bar( + fillable = TRUE, + bslib::nav_panel( + title = "Overview", + tags$h3("Overview and filtering"), + fluidRow( + shiny::column( + width = 9, + shiny::uiOutput(outputId = "data_info", inline = TRUE), + shiny::tags$p( + "Below is a short summary table, on the right you can click to visualise data classes or browse data and create different data filters." + ) + ), + shiny::column( + width = 3, + shiny::actionButton( + inputId = "modal_visual_overview", + label = "Visual overview", + width = "100%", + disabled = TRUE + ), + shiny::br(), + shiny::br(), + shiny::actionButton( + inputId = "modal_browse", + label = "Browse data", + width = "100%", + disabled = TRUE + ), + shiny::br(), + shiny::br() + ) + ), + fluidRow( + shiny::column( + width = 9, + data_summary_ui(id = "data_summary"), + shiny::br(), + shiny::br(), + shiny::br(), + shiny::br(), + shiny::br() + ), + shiny::column( + width = 3, + # shiny::actionButton( + # inputId = "modal_missings", + # label = "Visual overview", + # width = "100%", + # disabled = TRUE + # ), + # shiny::br(), + # shiny::br(), + # shiny::actionButton( + # inputId = "modal_browse", + # label = "Browse data", + # width = "100%", + # disabled = TRUE + # ), + # shiny::br(), + # shiny::br(), + shiny::tags$h6("Filter data types"), + shiny::uiOutput( + outputId = "column_filter" + ), + shiny::helpText("Read more on how ", tags$a( + "data types", + href = "https://agdamsbo.github.io/FreesearchR/articles/data-types.html", + target = "_blank", + rel = "noopener noreferrer" + ), " are defined."), + shiny::br(), + shiny::br(), + shiny::tags$h6("Filter observations"), + shiny::tags$p("Filter on observation level"), + IDEAFilter::IDEAFilter_ui("data_filter"), + shiny::br(), + shiny::br() + ) + ), + shiny::br(), + shiny::br(), + # shiny::br(), + # shiny::br(), + shiny::br() + ), + bslib::nav_panel( + title = "Modify", + tags$h3("Subset, rename and convert variables"), + fluidRow( + shiny::column( + width = 9, + shiny::tags$p( + shiny::markdown("Below, are several options for simple data manipulation like update variables by renaming, creating new labels (for nicer tables in the report) and changing variable classes (numeric, factor/categorical etc.)."), + shiny::markdown("There are more advanced options to modify factor/categorical variables as well as create new factor from a continous variable or new variables with *R* code. At the bottom you can restore the original data."), + shiny::markdown("Please note that data modifications are applied before any filtering.") + ) + ) + ), + # shiny::tags$br(), + update_variables_ui("modal_variables"), + shiny::tags$br(), + shiny::tags$br(), + shiny::tags$h4("Advanced data manipulation"), + shiny::tags$p("Below options allow more advanced varaible manipulations."), + shiny::tags$br(), + shiny::tags$br(), + shiny::fluidRow( + shiny::column( + width = 4, + shiny::actionButton( + inputId = "modal_update", + label = "Reorder factor levels", + width = "100%" + ), + shiny::tags$br(), + shiny::helpText("Reorder the levels of factor/categorical variables."), + shiny::tags$br(), + shiny::tags$br() + ), + shiny::column( + width = 4, + shiny::actionButton( + inputId = "modal_cut", + label = "New factor", + width = "100%" + ), + shiny::tags$br(), + shiny::helpText("Create factor/categorical variable from a continous variable (number/date/time)."), + shiny::tags$br(), + shiny::tags$br() + ), + shiny::column( + width = 4, + shiny::actionButton( + inputId = "modal_column", + label = "New variable", + width = "100%" + ), + shiny::tags$br(), + shiny::helpText(shiny::markdown("Create a new variable/column based on an *R*-expression.")), + shiny::tags$br(), + shiny::tags$br() + ) + ), + tags$h4("Compare modified data to original"), + shiny::tags$br(), shiny::tags$p( - "Below is a short summary table, on the right you can click to visualise data classes or browse data and create different data filters." - ) - ), - shiny::column( - width = 3, + "Raw print of the original vs the modified data." + ), + shiny::tags$br(), + shiny::fluidRow( + shiny::column( + width = 6, + shiny::tags$b("Original data:"), + # verbatimTextOutput("original"), + shiny::verbatimTextOutput("original_str") + ), + shiny::column( + width = 6, + shiny::tags$b("Modified data:"), + # verbatimTextOutput("modified"), + shiny::verbatimTextOutput("modified_str") + ) + ), + shiny::tags$br(), shiny::actionButton( - inputId = "modal_visual_overview", - label = "Visual overview", - width = "100%", - disabled = TRUE + inputId = "data_reset", + label = "Restore original data", + width = "100%" ), - shiny::br(), - shiny::br(), - shiny::actionButton( - inputId = "modal_browse", - label = "Browse data", - width = "100%", - disabled = TRUE - ), - shiny::br(), - shiny::br() + shiny::tags$br(), + shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing."), + shiny::tags$br() ) - ), - fluidRow( - shiny::column( - width = 9, - data_summary_ui(id = "data_summary"), - shiny::br(), - shiny::br(), - shiny::br(), - shiny::br(), - shiny::br() - ), - shiny::column( - width = 3, - shiny::tags$h6("Filter data types"), - shiny::uiOutput( - outputId = "column_filter" - ), - shiny::helpText("Read more on how ", tags$a( - "data types", - href = "https://agdamsbo.github.io/FreesearchR/articles/data-types.html", - target = "_blank", - rel = "noopener noreferrer" - ), " are defined."), - shiny::br(), - shiny::br(), - shiny::tags$h6("Filter observations"), - shiny::tags$p("Filter on observation level"), - IDEAFilter::IDEAFilter_ui("data_filter"), - shiny::br(), - shiny::br() - ) - ), - shiny::br(), - shiny::br(), - shiny::br() + ) ), - bslib::nav_panel( - title = "Modify", - icon = shiny::icon("file-pen"), - tags$h3("Subset, rename and convert variables"), - fluidRow( - shiny::column( - width = 9, - shiny::tags$p( - shiny::markdown("Below, are several options for simple data manipulation like update variables by renaming, creating new labels (for nicer tables in the report) and changing variable classes (numeric, factor/categorical etc.)."), - shiny::markdown("There are more advanced options to modify factor/categorical variables as well as create new factor from a continous variable or new variables with *R* code. At the bottom you can restore the original data."), - shiny::markdown("Please note that data modifications are applied before any filtering.") - ) - ) - ), - update_variables_ui("modal_variables"), - shiny::tags$br(), - shiny::tags$br(), - shiny::tags$h4("Advanced data manipulation"), - shiny::tags$p("Below options allow more advanced varaible manipulations."), - shiny::tags$br(), - shiny::tags$br(), - shiny::fluidRow( - shiny::column( - width = 4, - shiny::actionButton( - inputId = "modal_update", - label = "Reorder factor levels", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText("Reorder the levels of factor/categorical variables."), - shiny::tags$br(), - shiny::tags$br() - ), - shiny::column( - width = 4, - shiny::actionButton( - inputId = "modal_cut", - label = "New factor", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText("Create factor/categorical variable from a continous variable (number/date/time)."), - shiny::tags$br(), - shiny::tags$br() - ), - shiny::column( - width = 4, - shiny::actionButton( - inputId = "modal_column", - label = "New variable", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText(shiny::markdown("Create a new variable/column based on an *R*-expression.")), - shiny::tags$br(), - shiny::tags$br() - ) - ), - tags$h4("Compare modified data to original"), - shiny::tags$br(), - shiny::tags$p( - "Raw print of the original vs the modified data." - ), - shiny::tags$br(), - shiny::fluidRow( - shiny::column( - width = 6, - shiny::tags$b("Original data:"), - shiny::verbatimTextOutput("original_str") - ), - shiny::column( - width = 6, - shiny::tags$b("Modified data:"), - shiny::verbatimTextOutput("modified_str") - ) - ), - shiny::tags$br(), - shiny::actionButton( - inputId = "data_reset", - label = "Restore original data", - width = "100%" - ), - shiny::tags$br(), - shiny::helpText("Reset to original imported dataset. Careful! There is no un-doing."), - shiny::tags$br() - ) - # ) - ), ############################################################################## ######### ######### Descriptive analyses panel ######### ############################################################################## "describe" = - bslib::nav_menu( + bslib::nav_panel( title = "Evaluate", - icon = shiny::icon("magnifying-glass-chart"), - # id = "navdescribe", - # bslib::navset_bar( - # title = "", - bslib::nav_panel( - title = "Characteristics", - icon = bsicons::bs_icon("table"), - bslib::layout_sidebar( - sidebar = bslib::sidebar( - shiny::uiOutput(outputId = "data_info_nochar", inline = TRUE), - bslib::accordion( - open = "acc_chars", - multiple = FALSE, - bslib::accordion_panel( - open = TRUE, - value = "acc_chars", - title = "Settings", - icon = bsicons::bs_icon("table"), - shiny::uiOutput("strat_var"), - shiny::helpText("Only factor/categorical variables are available for stratification. Go back to the 'Prepare' tab to reclass a variable if it's not on the list."), - shiny::conditionalPanel( - condition = "input.strat_var!='none'", - shiny::radioButtons( - inputId = "add_p", - label = "Compare strata?", - selected = "no", - inline = TRUE, - choices = list( - "No" = "no", - "Yes" = "yes" - ) - ), - shiny::helpText("Option to perform statistical comparisons between strata in baseline table.") + id = "navdescribe", + bslib::navset_bar( + title = "", + sidebar = bslib::sidebar( + shiny::uiOutput(outputId = "data_info_nochar", inline = TRUE), + bslib::accordion( + open = "acc_chars", + multiple = FALSE, + bslib::accordion_panel( + value = "acc_chars", + title = "Characteristics", + icon = bsicons::bs_icon("table"), + shiny::uiOutput("strat_var"), + shiny::helpText("Only factor/categorical variables are available for stratification. Go back to the 'Data' tab to reclass a variable if it's not on the list."), + shiny::conditionalPanel( + condition = "input.strat_var!='none'", + shiny::radioButtons( + inputId = "add_p", + label = "Compare strata?", + selected = "no", + inline = TRUE, + choices = list( + "No" = "no", + "Yes" = "yes" + ) ), - shiny::br(), - shiny::br(), - shiny::actionButton( - inputId = "act_eval", - label = "Evaluate", - width = "100%", - icon = shiny::icon("calculator"), - disabled = TRUE - ) + shiny::helpText("Option to perform statistical comparisons between strata in baseline table.") + ), + shiny::br(), + shiny::br(), + shiny::actionButton( + inputId = "act_eval", + label = "Evaluate", + width = "100%", + icon = shiny::icon("calculator"), + disabled = TRUE ) + ), + bslib::accordion_panel( + vlaue = "acc_cor", + title = "Correlations", + icon = bsicons::bs_icon("bounding-box"), + shiny::uiOutput("outcome_var_cor"), + shiny::helpText("To avoid evaluating the correlation of the outcome variable, this can be excluded from the plot or select 'none'."), + shiny::br(), + shinyWidgets::noUiSliderInput( + inputId = "cor_cutoff", + label = "Correlation cut-off", + min = 0, + max = 1, + step = .01, + value = .8, + format = shinyWidgets::wNumbFormat(decimals = 2), + color = datamods:::get_primary_color() + ), + shiny::helpText("Set the cut-off for considered 'highly correlated'.") + ), + bslib::accordion_panel( + vlaue = "acc_mis", + title = "Missings", + icon = bsicons::bs_icon("x-circle"), + shiny::uiOutput("missings_var"), + shiny::helpText("To consider if daata is missing by random, choose the outcome/dependent variable, if it has any missings to evaluate if there is a significant difference across other variables depending on missing data or not.") ) - ), + ) + ), + bslib::nav_panel( + title = "Characteristics", gt::gt_output(outputId = "table1") - ) - ), - bslib::nav_panel( - title = "Correlations", - icon = bsicons::bs_icon("bounding-box"), - bslib::layout_sidebar( - sidebar = bslib::sidebar( - shiny::uiOutput(outputId = "data_info_nochar", inline = TRUE), - bslib::accordion( - open = "acc_chars", - multiple = FALSE, - bslib::accordion_panel( - value = "acc_cor", - title = "Correlations", - icon = bsicons::bs_icon("bounding-box"), - shiny::uiOutput("outcome_var_cor"), - shiny::helpText("To avoid evaluating the correlation of the outcome variable, this can be excluded from the plot or select 'none'."), - shiny::br(), - shinyWidgets::noUiSliderInput( - inputId = "cor_cutoff", - label = "Correlation cut-off", - min = 0, - max = 1, - step = .01, - value = .8, - format = shinyWidgets::wNumbFormat(decimals = 2), - color = datamods:::get_primary_color() - ), - shiny::helpText("Set the cut-off for considered 'highly correlated'.") - ) - ) - ), + ), + bslib::nav_panel( + title = "Correlations", data_correlations_ui(id = "correlations", height = 600) - ) - ), - bslib::nav_panel( - title = "Missings", - icon = bsicons::bs_icon("x-circle"), - bslib::layout_sidebar( - sidebar = bslib::sidebar( - bslib::accordion( - open = "acc_chars", - multiple = FALSE, - bslib::accordion_panel( - vlaue = "acc_mis", - title = "Missings", - icon = bsicons::bs_icon("x-circle"), - shiny::uiOutput("missings_var"), - shiny::helpText("To consider if data is missing by random, choose the outcome/dependent variable, if it has any missings to evaluate if there is a significant difference across other variables depending on missing data or not.") - ) - ) - ), + ), + bslib::nav_panel( + title = "Missings", data_missings_ui(id = "missingness") ) ) @@ -10313,23 +10286,27 @@ ui_elements <- list( ######### Download panel ######### ############################################################################## - "visuals" = do.call( - bslib::nav_panel, - c( - list( - title = "Visuals", - icon = shiny::icon("chart-line"), - id = "navvisuals" - ), - data_visuals_ui("visuals") + "visuals" = bslib::nav_panel( + title = "Visuals", + id = "navvisuals", + do.call( + bslib::navset_bar, + c( + data_visuals_ui("visuals"), + shiny::tagList( + bslib::nav_spacer(), + bslib::nav_item( + # shiny::img(shiny::icon("book")), + shiny::tags$a( + href = "https://agdamsbo.github.io/FreesearchR/articles/visuals.html", + "Notes (external)", + target = "_blank", + rel = "noopener noreferrer" + ) + ) + ) + ) ) - # do.call( - # bslib::navset_bar, - # data_visuals_ui("visuals")#, - # c( - - # ) - # ) ), ############################################################################## ######### @@ -10339,10 +10316,9 @@ ui_elements <- list( "analyze" = bslib::nav_panel( title = "Regression", - icon = shiny::icon("calculator"), id = "navanalyses", do.call( - bslib::navset_card_tab, + bslib::navset_bar, regression_ui("regression") ) ), @@ -10354,7 +10330,6 @@ ui_elements <- list( "download" = bslib::nav_panel( title = "Download", - icon = shiny::icon("download"), id = "navdownload", shiny::fluidRow( shiny::column(width = 2), @@ -10480,42 +10455,9 @@ dark <- custom_theme( # https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/ ui <- bslib::page_fixed( - ## Code formatting dependencies prismDependencies, prismRDependency, - ## Version dependent header header_include(), - ## Automatically close drop-downs on navigation - ## Thanks to claude.ai - # tags$script(" - # $(document).on('shown.bs.tab', '#main_panel', function(e) { - # // Close dropdown in this specific navset only - # $('#main_panel .dropdown-menu').removeClass('show'); - # $('#main_panel .dropdown-toggle').removeClass('show').attr('aria-expanded', 'false'); - # }); - # - # $(document).on('shiny:sessioninitialized', function() { - # // Function to collapse navbar on mobile - # function collapseNavbar() { - # var navbar = $('.navbar-collapse'); - # if (navbar.hasClass('show')) { - # navbar.removeClass('show'); - # $('.navbar-toggler').addClass('collapsed'); - # $('.navbar-toggler').attr('aria-expanded', 'false'); - # } - # } - # - # // Add click event to navigation tabs - # $(document).on('click', '.nav-link[data-bs-toggle=\"tab\"]', function() { - # setTimeout(collapseNavbar, 10); - # }); - # - # // Also handle direct clicks on nav items - # $(document).on('click', '.navbar-nav .nav-link', function() { - # setTimeout(collapseNavbar, 10); - # }); - # }); - # "), ## This adds the actual favicon ## png and ico versions are kept for compatibility shiny::tags$head(tags$link(rel = "shortcut icon", href = "favicon.svg")), @@ -10535,14 +10477,14 @@ ui <- bslib::page_fixed( id = "main_panel", ui_elements$home, ui_elements$import, - ui_elements$prepare, + ui_elements$overview, ui_elements$describe, ui_elements$visuals, ui_elements$analyze, ui_elements$download, bslib::nav_spacer(), - # ui_elements$feedback, - # ui_elements$docs, + ui_elements$feedback, + ui_elements$docs, fillable = FALSE, footer = shiny::tags$footer( style = "background-color: #14131326; padding: 4px; text-align: center; bottom: 0; width: 100%;", @@ -10552,7 +10494,7 @@ ui <- bslib::page_fixed( ), shiny::p( style = "margin: 1; color: #888;", - shiny::tags$a("Documentation", href = "https://agdamsbo.github.io/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", hosted_version(), " | ", shiny::tags$a("License: AGPLv3", href = "https://github.com/agdamsbo/FreesearchR/blob/main/LICENSE.md", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Source", href = "https://github.com/agdamsbo/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Share feedback", href = "https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8", target = "_blank", rel = "noopener noreferrer") + shiny::tags$a("Docs", href = "https://agdamsbo.github.io/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", hosted_version(), " | ", shiny::tags$a("License: AGPLv3", href = "https://github.com/agdamsbo/FreesearchR/blob/main/LICENSE.md", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Source", href = "https://github.com/agdamsbo/FreesearchR/", target = "_blank", rel = "noopener noreferrer"), " | ", shiny::tags$a("Share feedback", href = "https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8", target = "_blank", rel = "noopener noreferrer") ), ) ) @@ -10562,7 +10504,7 @@ ui <- bslib::page_fixed( ######## -#### Current file: /Users/au301842/FreesearchR/app/server.R +#### Current file: /Users/au301842/FreesearchR/app/server.R ######## data(mtcars) @@ -11264,7 +11206,7 @@ server <- function(input, output, session) { ############################################################################## shiny::observeEvent(input$act_start, { - bslib::nav_select(id = "main_panel", selected = "nav_prepare_overview") + bslib::nav_select(id = "main_panel", selected = "Data") }) ############################################################################## @@ -11369,7 +11311,7 @@ server <- function(input, output, session) { ######## -#### Current file: /Users/au301842/FreesearchR/app/launch.R +#### Current file: /Users/au301842/FreesearchR/app/launch.R ######## shinyApp(ui, server) diff --git a/inst/apps/FreesearchR/www/FreesearchR-logo-black-nobg.png b/inst/apps/FreesearchR/www/FreesearchR-logo-black-nobg.png deleted file mode 100644 index 2b927071..00000000 Binary files a/inst/apps/FreesearchR/www/FreesearchR-logo-black-nobg.png and /dev/null differ diff --git a/inst/apps/FreesearchR/www/FreesearchR-logo-blue-nobg.png b/inst/apps/FreesearchR/www/FreesearchR-logo-blue-nobg.png deleted file mode 100644 index 0a0e5729..00000000 Binary files a/inst/apps/FreesearchR/www/FreesearchR-logo-blue-nobg.png and /dev/null differ diff --git a/inst/apps/FreesearchR/www/FreesearchR-logo-white-nobg-h80.png b/inst/apps/FreesearchR/www/FreesearchR-logo-white-nobg-h80.png deleted file mode 100644 index 2423010d..00000000 Binary files a/inst/apps/FreesearchR/www/FreesearchR-logo-white-nobg-h80.png and /dev/null differ diff --git a/inst/apps/FreesearchR/www/FreesearchR-logo-white-nobg.png b/inst/apps/FreesearchR/www/FreesearchR-logo-white-nobg.png deleted file mode 100644 index d9a68834..00000000 Binary files a/inst/apps/FreesearchR/www/FreesearchR-logo-white-nobg.png and /dev/null differ diff --git a/inst/apps/FreesearchR/www/scripts.js b/inst/apps/FreesearchR/www/scripts.js deleted file mode 100644 index 3382b4e4..00000000 --- a/inst/apps/FreesearchR/www/scripts.js +++ /dev/null @@ -1,29 +0,0 @@ -// Automatically close drop-downs on navigation -// Thanks to claude.ai -$(document).on('shown.bs.tab', '#main_panel', function(e) { - // Close dropdown in this specific navset only - $('#main_panel .dropdown-menu').removeClass('show'); - $('#main_panel .dropdown-toggle').removeClass('show').attr('aria-expanded', 'false'); -}); - -$(document).on('shiny:sessioninitialized', function() { -// Function to collapse navbar on mobile -function collapseNavbar() { - var navbar = $('.navbar-collapse'); - if (navbar.hasClass('show')) { - navbar.removeClass('show'); - $('.navbar-toggler').addClass('collapsed'); - $('.navbar-toggler').attr('aria-expanded', 'false'); - } - } - - // Add click event to navigation tabs - $(document).on('click', '.nav-link[data-bs-toggle=\"tab\"]', function() { - setTimeout(collapseNavbar, 10); - }); - - // Also handle direct clicks on nav items - $(document).on('click', '.navbar-nav .nav-link', function() { - setTimeout(collapseNavbar, 10); - }); -}); diff --git a/inst/assets/js/FreesearchR.js b/inst/assets/js/FreesearchR.js deleted file mode 100644 index 3382b4e4..00000000 --- a/inst/assets/js/FreesearchR.js +++ /dev/null @@ -1,29 +0,0 @@ -// Automatically close drop-downs on navigation -// Thanks to claude.ai -$(document).on('shown.bs.tab', '#main_panel', function(e) { - // Close dropdown in this specific navset only - $('#main_panel .dropdown-menu').removeClass('show'); - $('#main_panel .dropdown-toggle').removeClass('show').attr('aria-expanded', 'false'); -}); - -$(document).on('shiny:sessioninitialized', function() { -// Function to collapse navbar on mobile -function collapseNavbar() { - var navbar = $('.navbar-collapse'); - if (navbar.hasClass('show')) { - navbar.removeClass('show'); - $('.navbar-toggler').addClass('collapsed'); - $('.navbar-toggler').attr('aria-expanded', 'false'); - } - } - - // Add click event to navigation tabs - $(document).on('click', '.nav-link[data-bs-toggle=\"tab\"]', function() { - setTimeout(collapseNavbar, 10); - }); - - // Also handle direct clicks on nav items - $(document).on('click', '.navbar-nav .nav-link', function() { - setTimeout(collapseNavbar, 10); - }); -}); diff --git a/man/compare_missings.Rd b/man/compare_missings.Rd deleted file mode 100644 index 8950200c..00000000 --- a/man/compare_missings.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/missings-module.R -\name{compare_missings} -\alias{compare_missings} -\title{Pairwise comparison of missings across covariables} -\usage{ -compare_missings(data, by_var) -} -\arguments{ -\item{data}{data frame} - -\item{by_var}{variable to stratify by missingness} -} -\value{ -gtsummary list object -} -\description{ -Pairwise comparison of missings across covariables -} diff --git a/vignettes/missingness.Rmd b/vignettes/missingness.Rmd deleted file mode 100644 index b070878b..00000000 --- a/vignettes/missingness.Rmd +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "Missingness in data" -output: rmarkdown::html_vignette -vignette: > - %\VignetteIndexEntry{missingness} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -```{r, include = FALSE} -knitr::opts_chunk$set( - collapse = TRUE, - comment = "#>" -) -options(rmarkdown.html_vignette.check_title = FALSE) -``` - -```{r setup} -library(FreesearchR) -``` - -## Considering missing observations - -### Further reading - -The authors behind the [{finalfit}-package]() have shared a very comprehensive article on what to do and think about missing observations in your data. Please [have a look here]().