diff --git a/CITATION.cff b/CITATION.cff index 27be40e0..ff5aba86 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.4.5 +version: 25.5.1 doi: 10.5281/zenodo.14527429 abstract: Easily evaluate and analysis clinical health data in your browser on a server or on your own device. Import data from multiple sources, summarise, modify and diff --git a/DESCRIPTION b/DESCRIPTION index 1832158a..534b0dc4 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.4.5 +Version: 25.5.1 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/NEWS.md b/NEWS.md index 4de9b76d..d8a2c68e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +# FreesearchR 25.5.1 + +- *FIX*: correct export of single variable plot. + +- *NEW*: Include app version in report for reference. + +- *NEW*: Show progress on connecting to a REDCap database. + +- *FIX*: Data import code export. + # FreesearchR 25.4.5 - *BUG*: Regression results and code not returned correctly diff --git a/R/app_version.R b/R/app_version.R index 6d74916b..724053ed 100644 --- a/R/app_version.R +++ b/R/app_version.R @@ -1 +1 @@ -app_version <- function()'v25.4.5.250430' +app_version <- function()'25.5.1' diff --git a/R/data_plots.R b/R/data_plots.R index 51fc249c..9ccdd989 100644 --- a/R/data_plots.R +++ b/R/data_plots.R @@ -45,15 +45,23 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) { title = "Download", icon = bsicons::bs_icon("download"), shinyWidgets::noUiSliderInput( - inputId = ns("height"), + 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() + 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)", @@ -372,17 +380,32 @@ data_visuals_server <- function(id, } }) + # shiny::observeEvent(input$height_numeric, { + # shinyWidgets::updateNoUiSliderInput(session, ns("height_slide"), value = input$height_numeric) + # }, ignoreInit = TRUE) + # shiny::observeEvent(input$height_slide, { + # shiny::updateNumericInput(session, ns("height_numeric"), value = input$height_slide) + # }, ignoreInit = TRUE) + + output$download_plot <- shiny::downloadHandler( filename = shiny::reactive({ paste0("plot.", input$plot_type) }), content = function(file) { + if (inherits(rv$plot,"patchwork")){ + plot <- rv$plot + } else { + plot <- rv$plot[[1]] + + } + # browser() shiny::withProgress(message = "Drawing the plot. Hold on for a moment..", { ggplot2::ggsave( filename = file, - plot = rv$plot, + plot = plot, width = input$width, - height = input$height, + height = input$height_slide, dpi = 300, units = "mm", scale = 2 ) @@ -517,8 +540,8 @@ supported_plots <- function() { fun = "plot_euler", descr = "Euler diagram", note = "Generate area-proportional Euler diagrams to display set relationships", - primary.type = "dichotomous", - secondary.type = "dichotomous", + primary.type = c("dichotomous", "categorical"), + secondary.type = c("dichotomous", "categorical"), secondary.multi = TRUE, secondary.max = 4, tertiary.type = c("dichotomous", "categorical"), diff --git a/R/helpers.R b/R/helpers.R index e9f8394b..377badb5 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -65,7 +65,7 @@ write_rmd <- function(data, ...) { ## Ref: https://github.com/quarto-dev/quarto-cli/discussions/4041 ## Outputs to the same as the .qmd file rmarkdown::render( - params = list(data.file = "web_data.rds"), + params = list(data.file = "web_data.rds",version=app_version()), # execute_params = list(data.file = temp), ... ) diff --git a/R/hosted_version.R b/R/hosted_version.R new file mode 100644 index 00000000..317135d5 --- /dev/null +++ b/R/hosted_version.R @@ -0,0 +1 @@ +hosted_version <- function()'v25.5.1-250505' diff --git a/R/plot_euler.R b/R/plot_euler.R index 36c8f918..4dff9de5 100644 --- a/R/plot_euler.R +++ b/R/plot_euler.R @@ -109,6 +109,12 @@ plot_euler <- function(data, pri, sec, ter = NULL, seed = 2103) { #' ) |> plot_euler_single() #' mtcars[c("vs", "am")] |> plot_euler_single() plot_euler_single <- function(data) { + # if (any("categorical" %in% data_type(data))){ + # shape <- "ellipse" + # } else { + # shape <- "circle" + # } + data |> ggeulerr(shape = "circle") + ggplot2::theme_void() + diff --git a/R/redcap_read_shiny_module.R b/R/redcap_read_shiny_module.R index b051fc78..8857e5f0 100644 --- a/R/redcap_read_shiny_module.R +++ b/R/redcap_read_shiny_module.R @@ -112,7 +112,7 @@ m_redcap_readUI <- function(id, title = TRUE, url = NULL) { tags$p(phosphoricons::ph("info", weight = "bold"), "Please specify data to download, then press 'Import'.") ), dismissible = TRUE - )#, + ) # , ## TODO: Use busy indicator like on download to have button activate/deactivate # bslib::input_task_button( # id = ns("data_import"), @@ -200,7 +200,9 @@ m_redcap_readServer <- function(id) { ) # browser() - imported <- try(rlang::exec(REDCapR::redcap_metadata_read, !!!parameters), silent = TRUE) + shiny::withProgress({ + imported <- try(rlang::exec(REDCapR::redcap_metadata_read, !!!parameters), silent = TRUE) + },message = paste("Connecting to",data_rv$uri)) ## TODO: Simplify error messages if (inherits(imported, "try-error") || NROW(imported) < 1 || ifelse(is.list(imported), !isTRUE(imported$success), FALSE)) { @@ -227,8 +229,10 @@ m_redcap_readServer <- function(id) { include_data_alert( see_data_text = "Click to see data dictionary", dataIdName = "see_data", - extra = tags$p(tags$b(phosphoricons::ph("check", weight = "bold"), "Connected to server!"), - glue::glue("The {data_rv$info$project_title} project is loaded.")), + extra = tags$p( + tags$b(phosphoricons::ph("check", weight = "bold"), "Connected to server!"), + glue::glue("The {data_rv$info$project_title} project is loaded.") + ), btn_show_data = TRUE ) ) diff --git a/R/sysdata.rda b/R/sysdata.rda index e6434994..9d97392c 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/SESSION.md b/SESSION.md index 33e6cc5e..eb1735f3 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-04-30 | +|date |2025-05-05 | |rstudio |2024.12.1+563 Kousa Dogwood (desktop) | |pandoc |3.6.4 @ /opt/homebrew/bin/ (via rmarkdown) | |quarto |1.6.40 @ /usr/local/bin/quarto | -|FreesearchR |25.4.5.250430 | +|FreesearchR |25.5.1.250505 | -------------------------------------------------------------------------------- @@ -24,10 +24,8 @@ |package |loadedversion |date |source | |:-------------|:-------------|:----------|:--------------| |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) | |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) | |bit |4.6.0 |2025-03-06 |CRAN (R 4.4.1) | |bit64 |4.6.0-1 |2025-01-16 |CRAN (R 4.4.1) | @@ -37,21 +35,14 @@ |bsicons |0.1.2 |2023-11-04 |CRAN (R 4.4.0) | |bslib |0.9.0 |2025-01-30 |CRAN (R 4.4.1) | |cachem |1.1.0 |2024-05-16 |CRAN (R 4.4.1) | -|cards |0.6.0 |2025-04-11 |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) | |cli |3.6.5 |2025-04-23 |CRAN (R 4.4.1) | -|cluster |2.1.8.1 |2025-03-12 |CRAN (R 4.4.1) | -|colorspace |2.1-1 |2024-07-26 |CRAN (R 4.4.1) | |commonmark |1.9.5 |2025-03-17 |CRAN (R 4.4.1) | |correlation |0.8.7 |2025-03-03 |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) | @@ -70,47 +61,32 @@ |fastmap |1.2.0 |2024-05-15 |CRAN (R 4.4.1) | |fontawesome |0.5.3 |2024-11-16 |CRAN (R 4.4.1) | |forcats |1.0.0 |2023-01-29 |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) | |fs |1.6.6 |2025-04-12 |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) | -|ggcorrplot |0.1.4.1 |2023-09-05 |CRAN (R 4.4.0) | |ggplot2 |3.5.2 |2025-04-09 |CRAN (R 4.4.1) | -|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) | |gtable |0.3.6 |2024-10-25 |CRAN (R 4.4.1) | |gtsummary |2.2.0 |2025-04-14 |CRAN (R 4.4.1) | |haven |2.5.4 |2023-11-30 |CRAN (R 4.4.0) | |here |1.0.1 |2020-12-13 |CRAN (R 4.4.1) | -|Hmisc |5.2-3 |2025-03-16 |CRAN (R 4.4.1) | |hms |1.1.3 |2023-03-21 |CRAN (R 4.4.0) | -|htmlTable |2.4.3 |2024-07-21 |CRAN (R 4.4.0) | |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) | |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) | |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) | @@ -120,8 +96,6 @@ |modelbased |0.10.0 |2025-03-10 |CRAN (R 4.4.1) | |nlme |3.1-168 |2025-03-31 |CRAN (R 4.4.1) | |nloptr |2.2.1 |2025-03-17 |CRAN (R 4.4.1) | -|nnet |7.3-20 |2025-01-01 |CRAN (R 4.4.1) | -|openssl |2.3.2 |2025-02-03 |CRAN (R 4.4.1) | |openxlsx2 |1.15 |2025-04-25 |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) | @@ -131,7 +105,6 @@ |pkgbuild |1.4.7 |2025-03-24 |CRAN (R 4.4.1) | |pkgconfig |2.0.3 |2019-09-22 |CRAN (R 4.4.1) | |pkgload |1.4.0 |2024-06-28 |CRAN (R 4.4.0) | -|plyr |1.8.9 |2023-10-02 |CRAN (R 4.4.1) | |processx |3.8.6 |2025-02-21 |CRAN (R 4.4.1) | |profvis |0.4.0 |2024-09-20 |CRAN (R 4.4.1) | |promises |1.3.2 |2024-11-28 |CRAN (R 4.4.1) | @@ -139,13 +112,9 @@ |ps |1.9.1 |2025-04-12 |CRAN (R 4.4.1) | |purrr |1.0.4 |2025-02-05 |CRAN (R 4.4.1) | |quarto |1.4.4 |2024-07-20 |CRAN (R 4.4.0) | -|R.cache |0.16.0 |2022-07-21 |CRAN (R 4.4.0) | -|R.methodsS3 |1.8.2 |2022-06-13 |CRAN (R 4.4.1) | -|R.oo |1.27.0 |2024-11-01 |CRAN (R 4.4.1) | -|R.utils |2.13.0 |2025-02-24 |CRAN (R 4.4.1) | |R6 |2.6.1 |2025-02-15 |CRAN (R 4.4.1) | |ragg |1.4.0 |2025-04-10 |CRAN (R 4.4.1) | -|rappdirs |0.3.3 |2021-01-31 |CRAN (R 4.4.1) | +|rankinPlot |1.1.0 |2023-01-30 |CRAN (R 4.4.0) | |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) | @@ -158,13 +127,12 @@ |REDCapR |1.4.0 |2025-01-11 |CRAN (R 4.4.1) | |reformulas |0.4.0 |2024-11-03 |CRAN (R 4.4.1) | |remotes |2.5.0 |2024-03-17 |CRAN (R 4.4.1) | +|rempsyc |0.1.9 |2025-02-01 |CRAN (R 4.4.1) | |renv |1.1.4 |2025-03-20 |CRAN (R 4.4.1) | |report |0.6.1 |2025-02-07 |CRAN (R 4.4.1) | -|reshape2 |1.4.4 |2020-04-09 |CRAN (R 4.4.0) | |rio |1.2.3 |2024-09-25 |CRAN (R 4.4.1) | |rlang |1.1.6 |2025-04-11 |CRAN (R 4.4.1) | |rmarkdown |2.29 |2024-11-04 |CRAN (R 4.4.1) | -|rpart |4.1.24 |2025-01-07 |CRAN (R 4.4.1) | |rprojroot |2.0.4 |2023-11-05 |CRAN (R 4.4.1) | |rsconnect |1.3.4 |2025-01-22 |CRAN (R 4.4.1) | |rstudioapi |0.17.1 |2024-10-22 |CRAN (R 4.4.1) | @@ -177,9 +145,6 @@ |shinyTime |1.0.3 |2022-08-19 |CRAN (R 4.4.0) | |shinyWidgets |0.9.0 |2025-02-21 |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) | |textshaping |1.0.0 |2025-01-20 |CRAN (R 4.4.1) | |tibble |3.2.1 |2023-03-20 |CRAN (R 4.4.0) | @@ -189,8 +154,8 @@ |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) | -|V8 |6.0.3 |2025-03-26 |CRAN (R 4.4.1) | |vctrs |0.6.5 |2023-12-01 |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) | diff --git a/inst/apps/FreesearchR/app.R b/inst/apps/FreesearchR/app.R index 347b471c..9eb25899 100644 --- a/inst/apps/FreesearchR/app.R +++ b/inst/apps/FreesearchR/app.R @@ -10,7 +10,7 @@ #### Current file: /Users/au301842/FreesearchR/R//app_version.R ######## -app_version <- function()'v25.4.4.250430' +app_version <- function()'25.5.1' ######## @@ -1619,15 +1619,23 @@ data_visuals_ui <- function(id, tab_title = "Plots", ...) { title = "Download", icon = bsicons::bs_icon("download"), shinyWidgets::noUiSliderInput( - inputId = ns("height"), + 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() + 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)", @@ -1946,17 +1954,32 @@ data_visuals_server <- function(id, } }) + # shiny::observeEvent(input$height_numeric, { + # shinyWidgets::updateNoUiSliderInput(session, ns("height_slide"), value = input$height_numeric) + # }, ignoreInit = TRUE) + # shiny::observeEvent(input$height_slide, { + # shiny::updateNumericInput(session, ns("height_numeric"), value = input$height_slide) + # }, ignoreInit = TRUE) + + output$download_plot <- shiny::downloadHandler( filename = shiny::reactive({ paste0("plot.", input$plot_type) }), content = function(file) { + if (inherits(rv$plot,"patchwork")){ + plot <- rv$plot + } else { + plot <- rv$plot[[1]] + + } + # browser() shiny::withProgress(message = "Drawing the plot. Hold on for a moment..", { ggplot2::ggsave( filename = file, - plot = rv$plot, + plot = plot, width = input$width, - height = input$height, + height = input$height_slide, dpi = 300, units = "mm", scale = 2 ) @@ -2091,8 +2114,8 @@ supported_plots <- function() { fun = "plot_euler", descr = "Euler diagram", note = "Generate area-proportional Euler diagrams to display set relationships", - primary.type = "dichotomous", - secondary.type = "dichotomous", + primary.type = c("dichotomous", "categorical"), + secondary.type = c("dichotomous", "categorical"), secondary.multi = TRUE, secondary.max = 4, tertiary.type = c("dichotomous", "categorical"), @@ -3338,7 +3361,7 @@ write_rmd <- function(data, ...) { ## Ref: https://github.com/quarto-dev/quarto-cli/discussions/4041 ## Outputs to the same as the .qmd file rmarkdown::render( - params = list(data.file = "web_data.rds"), + params = list(data.file = "web_data.rds",version=app_version()), # execute_params = list(data.file = temp), ... ) @@ -3927,6 +3950,13 @@ is_identical_to_previous <- function(data, no.name = TRUE) { } +######## +#### Current file: /Users/au301842/FreesearchR/R//hosted_version.R +######## + +hosted_version <- function()'v25.5.1-250505' + + ######## #### Current file: /Users/au301842/FreesearchR/R//html_dependency_freesearchr.R ######## @@ -4784,6 +4814,12 @@ plot_euler <- function(data, pri, sec, ter = NULL, seed = 2103) { #' ) |> plot_euler_single() #' mtcars[c("vs", "am")] |> plot_euler_single() plot_euler_single <- function(data) { + # if (any("categorical" %in% data_type(data))){ + # shape <- "ellipse" + # } else { + # shape <- "circle" + # } + data |> ggeulerr(shape = "circle") + ggplot2::theme_void() + @@ -5441,7 +5477,7 @@ m_redcap_readUI <- function(id, title = TRUE, url = NULL) { tags$p(phosphoricons::ph("info", weight = "bold"), "Please specify data to download, then press 'Import'.") ), dismissible = TRUE - )#, + ) # , ## TODO: Use busy indicator like on download to have button activate/deactivate # bslib::input_task_button( # id = ns("data_import"), @@ -5529,7 +5565,9 @@ m_redcap_readServer <- function(id) { ) # browser() - imported <- try(rlang::exec(REDCapR::redcap_metadata_read, !!!parameters), silent = TRUE) + shiny::withProgress({ + imported <- try(rlang::exec(REDCapR::redcap_metadata_read, !!!parameters), silent = TRUE) + },message = paste("Connecting to",data_rv$uri)) ## TODO: Simplify error messages if (inherits(imported, "try-error") || NROW(imported) < 1 || ifelse(is.list(imported), !isTRUE(imported$success), FALSE)) { @@ -5556,8 +5594,10 @@ m_redcap_readServer <- function(id) { include_data_alert( see_data_text = "Click to see data dictionary", dataIdName = "see_data", - extra = tags$p(tags$b(phosphoricons::ph("check", weight = "bold"), "Connected to server!"), - glue::glue("The {data_rv$info$project_title} project is loaded.")), + extra = tags$p( + tags$b(phosphoricons::ph("check", weight = "bold"), "Connected to server!"), + glue::glue("The {data_rv$info$project_title} project is loaded.") + ), btn_show_data = TRUE ) ) @@ -7521,7 +7561,8 @@ regression_server <- function(id, shiny::observeEvent( list( - data_r() + data_r(), + regression_vars() ), { rv$list$regression$tables <- NULL @@ -9397,8 +9438,8 @@ ui_elements <- list( 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 also 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 data or variable filtering is applied.") + 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.") ) ) ), @@ -9687,14 +9728,28 @@ ui_elements <- list( ), ############################################################################## ######### - ######### Documentation panel + ######### Feedback link + ######### + ############################################################################## + "feedback" = bslib::nav_item( + # shiny::img(shiny::icon("book")), + shiny::tags$a( + href = "https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8", + "Feedback",shiny::icon("arrow-up-right-from-square"), + target = "_blank", + rel = "noopener noreferrer" + ) + ), + ############################################################################## + ######### + ######### Documentation link ######### ############################################################################## "docs" = bslib::nav_item( # shiny::img(shiny::icon("book")), shiny::tags$a( href = "https://agdamsbo.github.io/FreesearchR/", - "Docs (external)", + "Docs",shiny::icon("arrow-up-right-from-square"), target = "_blank", rel = "noopener noreferrer" ) @@ -9736,6 +9791,7 @@ ui <- bslib::page_fixed( ui_elements$analyze, ui_elements$download, bslib::nav_spacer(), + ui_elements$feedback, ui_elements$docs, fillable = FALSE, footer = shiny::tags$footer( @@ -9746,7 +9802,7 @@ ui <- bslib::page_fixed( ), shiny::p( style = "margin: 1; color: #888;", - shiny::tags$a("Docs", href = "https://agdamsbo.github.io/FreesearchR/", target = "_blank", rel = "noopener noreferrer")," | ", app_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") ), ) ) @@ -9773,9 +9829,7 @@ library(quarto) library(here) library(broom) library(broom.helpers) -# library(REDCapCAST) library(easystats) -# library(esquisse) library(patchwork) library(DHARMa) library(apexcharter) @@ -9786,32 +9840,17 @@ library(shinyWidgets) library(DT) library(data.table) library(gtsummary) -# library(FreesearchR) - -# source("functions.R") data(starwars) data(mtcars) -mtcars_date <- mtcars |> append_column(as.Date(sample(1:365, nrow(mtcars))), "rand_dates") -mtcars_date$date <- as.Date(sample(seq_len(365), nrow(mtcars))) data(trial) -# light <- custom_theme() -# -# dark <- custom_theme(bg = "#000",fg="#fff") - - server <- function(input, output, session) { ## Listing files in www in session start to keep when ending and removing ## everything else. files.to.keep <- list.files("www/") - output$docs_file <- shiny::renderUI({ - # shiny::includeHTML("www/docs.html") - shiny::HTML(readLines("www/docs.html")) - }) - ############################################################################## ######### ######### Night mode (just very popular, not really needed) @@ -10254,10 +10293,12 @@ server <- function(input, output, session) { # }) output$code_import <- shiny::renderUI({ + shiny::req(rv$code$import) prismCodeBlock(paste0("#Data import\n", rv$code$import)) }) - output$code_import <- shiny::renderUI({ + output$code_format <- shiny::renderUI({ + shiny::req(rv$code$format) prismCodeBlock(paste0("#Data import formatting\n", rv$code$format)) }) @@ -10480,20 +10521,11 @@ server <- function(input, output, session) { paste0("report.", input$output_type) }), content = function(file, type = input$output_type) { - # browser() - # shiny::req(rv$list$regression) ## Notification is not progressing ## Presumably due to missing - # browser() # Simplified for .rmd output attempt format <- ifelse(type == "docx", "word_document", "odt_document") - # browser() - # if (shiny::is.reactive(rv$regression)){ - # rv$list$regression <- rv$regression() - # } - - # rv$list$regression <- rv$regression() rv$list$regression <- rv$regression() shiny::withProgress(message = "Generating the report. Hold on for a moment..", { diff --git a/inst/apps/FreesearchR/www/intro.md b/inst/apps/FreesearchR/www/intro.md index aa84e178..f1432c8b 100644 --- a/inst/apps/FreesearchR/www/intro.md +++ b/inst/apps/FreesearchR/www/intro.md @@ -30,4 +30,4 @@ Here is a brief summary of the functions: - Code to recreate all steps locally -The full [project documentation is here](https://agdamsbo.github.io/FreesearchR/) where you'll find detailed description of the app and link to the source code! If you want to [share feedback, please follow this link to a simple survey](https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8), or share on [GitHub](https://github.com/agdamsbo/FreesearchR/issues). +The full [project documentation is here](https://agdamsbo.github.io/FreesearchR/) where you'll find detailed description of the app and link to the source code! If you want to [share feedback, please follow this link to a simple survey](https://redcap.au.dk/surveys/?s=JPCLPTXYDKFA8DA8). diff --git a/inst/apps/FreesearchR/www/report.rmd b/inst/apps/FreesearchR/www/report.rmd index b93d47e3..9a2013b3 100644 --- a/inst/apps/FreesearchR/www/report.rmd +++ b/inst/apps/FreesearchR/www/report.rmd @@ -6,6 +6,7 @@ author: FreesearchR data analysis tool toc: false params: data.file: NA + version: NA --- ```{r setup, echo = FALSE} @@ -46,7 +47,7 @@ Research should be free and open with easy access for all. The FreesearchR tool ## Methods -Analyses were conducted in the *FreesearchR* data analysis web-tool based on R version 4.4.1. +Analyses were conducted using the *FreesearchR* data analysis web-tool version `r params$version` based on *R* version 4.4.1. ## Results