mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 18:09:39 +02:00
Compare commits
No commits in common. "de66379a9e2f38c849eb78592e09fb3d28904d7a" and "6b1a8af175176cd8d2b037ded40a5cf4de3d2596" have entirely different histories.
de66379a9e
...
6b1a8af175
10 changed files with 607 additions and 2183 deletions
13
CITATION.cff
13
CITATION.cff
|
@ -1259,19 +1259,6 @@ references:
|
||||||
orcid: https://orcid.org/0000-0001-8457-4658
|
orcid: https://orcid.org/0000-0001-8457-4658
|
||||||
year: '2025'
|
year: '2025'
|
||||||
doi: 10.32614/CRAN.package.cffr
|
doi: 10.32614/CRAN.package.cffr
|
||||||
- type: software
|
|
||||||
title: shiny2docker
|
|
||||||
abstract: 'shiny2docker: Generate Dockerfiles for ''Shiny'' Applications'
|
|
||||||
notes: Suggests
|
|
||||||
url: https://github.com/VincentGuyader/shiny2docker
|
|
||||||
repository: https://CRAN.R-project.org/package=shiny2docker
|
|
||||||
authors:
|
|
||||||
- family-names: Guyader
|
|
||||||
given-names: Vincent
|
|
||||||
email: vincent@thinkr.fr
|
|
||||||
orcid: https://orcid.org/0000-0003-0671-9270
|
|
||||||
year: '2025'
|
|
||||||
doi: 10.32614/CRAN.package.shiny2docker
|
|
||||||
- type: software
|
- type: software
|
||||||
title: 'R: A Language and Environment for Statistical Computing'
|
title: 'R: A Language and Environment for Statistical Computing'
|
||||||
notes: Depends
|
notes: Depends
|
||||||
|
|
|
@ -340,7 +340,7 @@ data_visuals_server <- function(id,
|
||||||
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)})")
|
rv$code <- glue::glue("FreesearchR::create_plot(data,{list2str(parameters)})")
|
||||||
},
|
},
|
||||||
# warning = function(warn) {
|
# warning = function(warn) {
|
||||||
# showNotification(paste0(warn), type = "warning")
|
# showNotification(paste0(warn), type = "warning")
|
||||||
|
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
23
README.md
23
README.md
|
@ -27,13 +27,7 @@ This app has the following simple goals:
|
||||||
|
|
||||||
## Run locally on your own machine
|
## Run locally on your own machine
|
||||||
|
|
||||||
The ***FreesearchR*** app can also run on your own machine with no data transmitted anywhere. Blow are the available options.
|
The ***FreesearchR*** app can also run on your own machine with no data transmitted anywhere. Any data.frame available in the global environment will be accessible from the interface. Just follow the below steps:
|
||||||
|
|
||||||
### Run from R (or RStduio)
|
|
||||||
|
|
||||||
Working with data in R, FreesearchR is a quick and easy tool to get overview and perform the first explorative analyses to get you going.
|
|
||||||
|
|
||||||
Any data available in the your R session will be available to the FreesearchR app. Just follow the below steps to get going:
|
|
||||||
|
|
||||||
1. **Requirement:** You need to have [*R* installed](https://www.r-project.org/) and possibly an editor like [RStudio](https://posit.co/download/rstudio-desktop/).
|
1. **Requirement:** You need to have [*R* installed](https://www.r-project.org/) and possibly an editor like [RStudio](https://posit.co/download/rstudio-desktop/).
|
||||||
|
|
||||||
|
@ -49,21 +43,6 @@ Any data available in the your R session will be available to the FreesearchR ap
|
||||||
launch_FreesearchR()
|
launch_FreesearchR()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running with docker compose
|
|
||||||
|
|
||||||
For advanced users, wanting to deploy the FreesearchR app to run anywhere, a docker image is available.
|
|
||||||
|
|
||||||
Below is the minimal `docker_compose.yml` file:
|
|
||||||
|
|
||||||
```
|
|
||||||
services:
|
|
||||||
freesearchr:
|
|
||||||
image: ghcr.io/agdamsbo/freesearchr:latest
|
|
||||||
ports:
|
|
||||||
- '3838:3838'
|
|
||||||
restart: on-failure
|
|
||||||
```
|
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
Please note that the ***FreesearchR*** project is published with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
|
Please note that the ***FreesearchR*** project is published with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
|apexcharter |0.4.4 |2024-09-06 |CRAN (R 4.4.1) |
|
|apexcharter |0.4.4 |2024-09-06 |CRAN (R 4.4.1) |
|
||||||
|askpass |1.2.1 |2024-10-04 |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) |
|
|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) |
|
|backports |1.5.0 |2024-05-23 |CRAN (R 4.4.1) |
|
||||||
|base64enc |0.1-3 |2015-07-28 |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) |
|
|bayestestR |0.15.3 |2025-04-28 |CRAN (R 4.4.1) |
|
||||||
|
@ -64,7 +62,6 @@
|
||||||
|devtools |2.4.5 |2022-10-11 |CRAN (R 4.4.0) |
|
|devtools |2.4.5 |2022-10-11 |CRAN (R 4.4.0) |
|
||||||
|DHARMa |0.4.7 |2024-10-18 |CRAN (R 4.4.1) |
|
|DHARMa |0.4.7 |2024-10-18 |CRAN (R 4.4.1) |
|
||||||
|digest |0.6.37 |2024-08-19 |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) |
|
|doParallel |1.0.17 |2022-02-07 |CRAN (R 4.4.0) |
|
||||||
|dplyr |1.1.4 |2023-11-17 |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) |
|
|DT |0.33 |2024-04-04 |CRAN (R 4.4.0) |
|
||||||
|
@ -142,7 +139,6 @@
|
||||||
|opdisDownsampling |1.0.1 |2024-04-15 |CRAN (R 4.4.0) |
|
|opdisDownsampling |1.0.1 |2024-04-15 |CRAN (R 4.4.0) |
|
||||||
|openssl |2.3.2 |2025-02-03 |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) |
|
|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) |
|
|parameters |0.24.2 |2025-03-04 |CRAN (R 4.4.1) |
|
||||||
|patchwork |1.3.0 |2024-09-16 |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) |
|
|pbmcapply |1.5.1 |2022-04-28 |CRAN (R 4.4.1) |
|
||||||
|
@ -202,7 +198,6 @@
|
||||||
|see |0.11.0 |2025-03-11 |CRAN (R 4.4.1) |
|
|see |0.11.0 |2025-03-11 |CRAN (R 4.4.1) |
|
||||||
|sessioninfo |1.2.3 |2025-02-05 |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) |
|
|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) |
|
|shinybusy |0.3.3 |2024-03-09 |CRAN (R 4.4.0) |
|
||||||
|shinyjs |2.1.0 |2021-12-23 |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) |
|
|shinyTime |1.0.3 |2022-08-19 |CRAN (R 4.4.0) |
|
||||||
|
@ -236,5 +231,4 @@
|
||||||
|xml2 |1.3.8 |2025-03-14 |CRAN (R 4.4.1) |
|
|xml2 |1.3.8 |2025-03-14 |CRAN (R 4.4.1) |
|
||||||
|xtable |1.8-4 |2019-04-21 |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) |
|
|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) |
|
|zip |2.3.2 |2025-02-01 |CRAN (R 4.4.1) |
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
FROM rocker/geospatial:4.4.1
|
FROM rocker/geospatial:4.4.1
|
||||||
RUN apt-get update -y && apt-get install -y cmake make libcurl4-openssl-dev libicu-dev libssl-dev pandoc zlib1g-dev libsecret-1-dev libxml2-dev libx11-dev libcairo2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libjpeg-dev libpng-dev libtiff-dev libfftw3-dev libsodium-dev && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update -y && apt-get install -y make pandoc zlib1g-dev libicu-dev libcurl4-openssl-dev libsecret-1-dev libxml2-dev libssl-dev libx11-dev libfontconfig1-dev libfreetype6-dev git libsodium-dev && rm -rf /var/lib/apt/lists/*
|
||||||
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
|
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
|
||||||
RUN echo "options(renv.config.pak.enabled = FALSE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
|
RUN echo "options(renv.config.pak.enabled = FALSE, repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
|
||||||
RUN R -e 'install.packages("remotes")'
|
RUN R -e 'install.packages("remotes")'
|
||||||
RUN R -e 'remotes::install_version("renv", version = "1.1.4")'
|
RUN R -e 'remotes::install_version("renv", version = "1.0.3")'
|
||||||
COPY renv.lock renv.lock
|
COPY renv.lock renv.lock
|
||||||
RUN --mount=type=cache,id=renv-cache,target=/root/.cache/R/renv R -e 'renv::restore()'
|
RUN --mount=type=cache,id=renv-cache,target=/root/.cache/R/renv R -e 'renv::restore()'
|
||||||
WORKDIR /srv/shiny-server/
|
WORKDIR /srv/shiny-server/
|
||||||
|
|
|
@ -1940,7 +1940,7 @@ data_visuals_server <- function(id,
|
||||||
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)})")
|
rv$code <- glue::glue("FreesearchR::create_plot(data,{list2str(parameters)})")
|
||||||
},
|
},
|
||||||
# warning = function(warn) {
|
# warning = function(warn) {
|
||||||
# showNotification(paste0(warn), type = "warning")
|
# showNotification(paste0(warn), type = "warning")
|
||||||
|
|
2184
app_docker/renv.lock
2184
app_docker/renv.lock
File diff suppressed because it is too large
Load diff
|
@ -1940,7 +1940,7 @@ data_visuals_server <- function(id,
|
||||||
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)})")
|
rv$code <- glue::glue("FreesearchR::create_plot(data,{list2str(parameters)})")
|
||||||
},
|
},
|
||||||
# warning = function(warn) {
|
# warning = function(warn) {
|
||||||
# showNotification(paste0(warn), type = "warning")
|
# showNotification(paste0(warn), type = "warning")
|
||||||
|
|
554
inst/apps/FreesearchR/ui.R
Normal file
554
inst/apps/FreesearchR/ui.R
Normal file
|
@ -0,0 +1,554 @@
|
||||||
|
# ns <- NS(id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ui_elements <- list(
|
||||||
|
##############################################################################
|
||||||
|
#########
|
||||||
|
######### Home panel
|
||||||
|
#########
|
||||||
|
##############################################################################
|
||||||
|
"home" = bslib::nav_panel(
|
||||||
|
title = "FreesearchR",
|
||||||
|
shiny::fluidRow(
|
||||||
|
shiny::column(width = 2),
|
||||||
|
shiny::column(
|
||||||
|
width = 8,
|
||||||
|
shiny::markdown(readLines("www/intro.md")),
|
||||||
|
shiny::column(width = 2)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
icon = shiny::icon("home")
|
||||||
|
),
|
||||||
|
##############################################################################
|
||||||
|
#########
|
||||||
|
######### Import panel
|
||||||
|
#########
|
||||||
|
##############################################################################
|
||||||
|
"import" = bslib::nav_panel(
|
||||||
|
title = "Import",
|
||||||
|
shiny::fluidRow(
|
||||||
|
shiny::column(width = 2),
|
||||||
|
shiny::column(
|
||||||
|
width = 8,
|
||||||
|
shiny::h4("Choose your data source"),
|
||||||
|
shiny::br(),
|
||||||
|
shinyWidgets::radioGroupButtons(
|
||||||
|
inputId = "source",
|
||||||
|
selected = "file",
|
||||||
|
choices = c(
|
||||||
|
"File upload" = "file",
|
||||||
|
"REDCap server export" = "redcap",
|
||||||
|
"Local or sample data" = "env"
|
||||||
|
),
|
||||||
|
size = "lg"
|
||||||
|
),
|
||||||
|
shiny::tags$script('document.querySelector("#source div").style.width = "100%"'),
|
||||||
|
shiny::helpText("Upload a file from your device, get data directly from REDCap or select a sample data set for testing from the app."),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::conditionalPanel(
|
||||||
|
condition = "input.source=='file'",
|
||||||
|
import_file_ui(
|
||||||
|
id = "file_import",
|
||||||
|
layout_params = "dropdown",
|
||||||
|
# title = "Choose a datafile to upload",
|
||||||
|
file_extensions = c(".csv", ".tsv", ".txt", ".xls", ".xlsx", ".rds", ".ods", ".dta")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::conditionalPanel(
|
||||||
|
condition = "input.source=='redcap'",
|
||||||
|
m_redcap_readUI(
|
||||||
|
id = "redcap_import",
|
||||||
|
title = ""
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::conditionalPanel(
|
||||||
|
condition = "input.source=='env'",
|
||||||
|
import_globalenv_ui(id = "env", title = NULL)
|
||||||
|
),
|
||||||
|
shiny::conditionalPanel(
|
||||||
|
condition = "input.source=='redcap'",
|
||||||
|
DT::DTOutput(outputId = "redcap_prev")
|
||||||
|
),
|
||||||
|
shiny::conditionalPanel(
|
||||||
|
condition = "output.data_loaded == true",
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::h5("Specify variables to include"),
|
||||||
|
shiny::fluidRow(
|
||||||
|
shiny::column(
|
||||||
|
width = 6,
|
||||||
|
shiny::br(),
|
||||||
|
shiny::p("Filter by completeness threshold and manual selection:"),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br()
|
||||||
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 6,
|
||||||
|
shinyWidgets::noUiSliderInput(
|
||||||
|
inputId = "complete_cutoff",
|
||||||
|
label = NULL,
|
||||||
|
update_on = "end",
|
||||||
|
min = 0,
|
||||||
|
max = 100,
|
||||||
|
step = 5,
|
||||||
|
value = 70,
|
||||||
|
format = shinyWidgets::wNumbFormat(decimals = 0),
|
||||||
|
color = datamods:::get_primary_color()
|
||||||
|
),
|
||||||
|
shiny::helpText("Exclude variables with completeness below the specified percentage."),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::uiOutput(outputId = "import_var"),
|
||||||
|
shiny::uiOutput(outputId = "data_info_import", inline = TRUE)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "act_start",
|
||||||
|
label = "Start",
|
||||||
|
width = "100%",
|
||||||
|
icon = shiny::icon("play"),
|
||||||
|
disabled = TRUE
|
||||||
|
),
|
||||||
|
shiny::helpText('After importing, hit "Start" or navigate to the desired tab.'),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::column(width = 2)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
##############################################################################
|
||||||
|
#########
|
||||||
|
######### Data overview panel
|
||||||
|
#########
|
||||||
|
##############################################################################
|
||||||
|
"overview" =
|
||||||
|
# bslib::nav_panel_hidden(
|
||||||
|
bslib::nav_panel(
|
||||||
|
# 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 browse data and create data filters."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
fluidRow(
|
||||||
|
shiny::column(
|
||||||
|
width = 9,
|
||||||
|
data_summary_ui(id = "data_summary")
|
||||||
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 3,
|
||||||
|
shiny::actionButton(
|
||||||
|
inputId = "modal_browse",
|
||||||
|
label = "Browse data",
|
||||||
|
width = "100%",
|
||||||
|
disabled = TRUE
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::uiOutput(outputId = "column_filter"),
|
||||||
|
shiny::helpText("Variable ", tags$a(
|
||||||
|
"data type",
|
||||||
|
href = "https://agdamsbo.github.io/FreesearchR/articles/data-types.html",
|
||||||
|
target = "_blank",
|
||||||
|
rel = "noopener noreferrer"
|
||||||
|
), " filtering."),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
IDEAFilter::IDEAFilter_ui("data_filter"),
|
||||||
|
shiny::helpText("Observations level filtering."),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::tags$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 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::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(
|
||||||
|
"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 = "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_panel(
|
||||||
|
title = "Evaluate",
|
||||||
|
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::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::nav_panel(
|
||||||
|
title = "Characteristics",
|
||||||
|
gt::gt_output(outputId = "table1")
|
||||||
|
),
|
||||||
|
bslib::nav_panel(
|
||||||
|
title = "Correlations",
|
||||||
|
data_correlations_ui(id = "correlations", height = 600)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
##############################################################################
|
||||||
|
#########
|
||||||
|
######### Download panel
|
||||||
|
#########
|
||||||
|
##############################################################################
|
||||||
|
"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"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
##############################################################################
|
||||||
|
#########
|
||||||
|
######### Regression analyses panel
|
||||||
|
#########
|
||||||
|
##############################################################################
|
||||||
|
"analyze" =
|
||||||
|
bslib::nav_panel(
|
||||||
|
title = "Regression",
|
||||||
|
id = "navanalyses",
|
||||||
|
do.call(
|
||||||
|
bslib::navset_bar,
|
||||||
|
regression_ui("regression")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
##############################################################################
|
||||||
|
#########
|
||||||
|
######### Download panel
|
||||||
|
#########
|
||||||
|
##############################################################################
|
||||||
|
"download" =
|
||||||
|
bslib::nav_panel(
|
||||||
|
title = "Download",
|
||||||
|
id = "navdownload",
|
||||||
|
shiny::fluidRow(
|
||||||
|
shiny::column(width = 2),
|
||||||
|
shiny::column(
|
||||||
|
width = 8,
|
||||||
|
shiny::fluidRow(
|
||||||
|
shiny::column(
|
||||||
|
width = 6,
|
||||||
|
shiny::h4("Report"),
|
||||||
|
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::selectInput(
|
||||||
|
inputId = "output_type",
|
||||||
|
label = "Output format",
|
||||||
|
selected = NULL,
|
||||||
|
choices = list(
|
||||||
|
"MS Word" = "docx",
|
||||||
|
"LibreOffice" = "odt"
|
||||||
|
# ,
|
||||||
|
# "PDF" = "pdf",
|
||||||
|
# "All the above" = "all"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::br(),
|
||||||
|
# Button
|
||||||
|
shiny::downloadButton(
|
||||||
|
outputId = "report",
|
||||||
|
label = "Download report",
|
||||||
|
icon = shiny::icon("download")
|
||||||
|
)
|
||||||
|
# shiny::helpText("If choosing to output to MS Word, please note, that when opening the document, two errors will pop-up. Choose to repair and choose not to update references. The issue is being worked on. You can always choose LibreOffice instead."),
|
||||||
|
),
|
||||||
|
shiny::column(
|
||||||
|
width = 6,
|
||||||
|
shiny::h4("Data"),
|
||||||
|
shiny::helpText("Choose your favourite output data format to download the modified data."),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::selectInput(
|
||||||
|
inputId = "data_type",
|
||||||
|
label = "Data format",
|
||||||
|
selected = NULL,
|
||||||
|
choices = list(
|
||||||
|
"R" = "rds",
|
||||||
|
"stata" = "dta",
|
||||||
|
"CSV" = "csv"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::helpText("No metadata is saved when exporting to csv."),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
# Button
|
||||||
|
shiny::downloadButton(
|
||||||
|
outputId = "data_modified",
|
||||||
|
label = "Download data",
|
||||||
|
icon = shiny::icon("download")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::br(),
|
||||||
|
shiny::h4("Code snippets"),
|
||||||
|
shiny::tags$p("Below are the code bits used to create the final data set and the main analyses."),
|
||||||
|
shiny::tags$p("This can be used as a starting point for learning to code and for reproducibility."),
|
||||||
|
shiny::tagList(
|
||||||
|
lapply(
|
||||||
|
paste0("code_", c(
|
||||||
|
"import", "format", "data", "variables", "filter", "table1", "univariable", "multivariable"
|
||||||
|
)),
|
||||||
|
\(.x)shiny::htmlOutput(outputId = .x)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
shiny::tags$br(),
|
||||||
|
shiny::br()
|
||||||
|
),
|
||||||
|
shiny::column(width = 2)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
##############################################################################
|
||||||
|
#########
|
||||||
|
######### Documentation panel
|
||||||
|
#########
|
||||||
|
##############################################################################
|
||||||
|
"docs" = bslib::nav_item(
|
||||||
|
# shiny::img(shiny::icon("book")),
|
||||||
|
shiny::tags$a(
|
||||||
|
href = "https://agdamsbo.github.io/FreesearchR/",
|
||||||
|
"Docs (external)",
|
||||||
|
target = "_blank",
|
||||||
|
rel = "noopener noreferrer"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
# bslib::nav_panel(
|
||||||
|
# title = "Documentation",
|
||||||
|
# # shiny::tags$iframe("www/docs.html", height=600, width=535),
|
||||||
|
# shiny::htmlOutput("docs_file"),
|
||||||
|
# shiny::br()
|
||||||
|
# )
|
||||||
|
)
|
||||||
|
# Initial attempt at creating light and dark versions
|
||||||
|
light <- custom_theme()
|
||||||
|
dark <- custom_theme(
|
||||||
|
bg = "#000",
|
||||||
|
fg = "#fff"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Fonts to consider:
|
||||||
|
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
|
||||||
|
|
||||||
|
ui_list <- shiny::tagList(
|
||||||
|
prismDependencies,
|
||||||
|
prismRDependency,
|
||||||
|
header_include(),
|
||||||
|
## This adds the actual favicon
|
||||||
|
## png and ico versions are kept for compatibility
|
||||||
|
shiny::tags$head(tags$link(rel="shortcut icon", href="favicon.svg")),
|
||||||
|
title = "FreesearchR",
|
||||||
|
theme = light,
|
||||||
|
shiny::useBusyIndicators(),
|
||||||
|
bslib::page_navbar(
|
||||||
|
id = "main_panel",
|
||||||
|
ui_elements$home,
|
||||||
|
ui_elements$import,
|
||||||
|
ui_elements$overview,
|
||||||
|
ui_elements$describe,
|
||||||
|
ui_elements$visuals,
|
||||||
|
ui_elements$analyze,
|
||||||
|
ui_elements$download,
|
||||||
|
bslib::nav_spacer(),
|
||||||
|
ui_elements$docs,
|
||||||
|
fillable = FALSE,
|
||||||
|
footer = shiny::tags$footer(
|
||||||
|
style = "background-color: #14131326; padding: 4px; text-align: center; bottom: 0; width: 100%;",
|
||||||
|
shiny::p(
|
||||||
|
style = "margin: 1",
|
||||||
|
"Data is only stored for analyses and deleted when the app is closed."
|
||||||
|
),
|
||||||
|
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")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
# ui_list <- shiny::tagAppendChild(ui_list,list(
|
||||||
|
# ## Basic Umami page tracking
|
||||||
|
# shiny::tags$head(includeHTML("www/umami-app.html"))
|
||||||
|
# # shiny::tags$head(shiny::tags$script(rel="defer", src="https://analytics.gdamsbo.dk/script.js", "data-website-id"="e7d4e13a-5824-4778-bbc0-8f92fb08303a"))
|
||||||
|
# ))
|
||||||
|
|
||||||
|
ui <- do.call(
|
||||||
|
bslib::page_fixed,ui_list)
|
Loading…
Add table
Reference in a new issue