mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 01:49:39 +02:00
re-added the report download option
This commit is contained in:
parent
7877d95176
commit
f07979e57c
5 changed files with 97 additions and 15 deletions
|
@ -2065,10 +2065,35 @@ ui_elements <- list(
|
|||
class = "fa-spin",
|
||||
"aria-hidden" = "true"
|
||||
),
|
||||
type = "primary",
|
||||
type = "secondary",
|
||||
auto_reset = TRUE
|
||||
),
|
||||
shiny::helpText("If you change the parameters, press 'Analyse' again to update the tables")
|
||||
shiny::helpText("If you change the parameters, press 'Analyse' again to update the tables"),
|
||||
# shiny::conditionalPanel(
|
||||
# condition = "output.ready=='yes'",
|
||||
shiny::tags$hr(),
|
||||
shiny::h4("Download results"),
|
||||
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
|
||||
shiny::selectInput(
|
||||
inputId = "output_type",
|
||||
label = "Output format",
|
||||
selected = NULL,
|
||||
choices = list(
|
||||
"Word" = "docx",
|
||||
"LibreOffice" = "odt"
|
||||
# ,
|
||||
# "PDF" = "pdf",
|
||||
# "All the above" = "all"
|
||||
)
|
||||
),
|
||||
shiny::br(),
|
||||
# Button
|
||||
shiny::downloadButton(
|
||||
outputId = "report",
|
||||
label = "Download",
|
||||
icon = shiny::icon("download")
|
||||
)
|
||||
# )
|
||||
# )
|
||||
),
|
||||
bslib::nav_panel(
|
||||
|
@ -2100,8 +2125,10 @@ ui_elements <- list(
|
|||
|
||||
# Initial attempt at creating light and dark versions
|
||||
light <- custom_theme()
|
||||
dark <- custom_theme(bg = "#000",
|
||||
fg="#fff")
|
||||
dark <- custom_theme(
|
||||
bg = "#000",
|
||||
fg = "#fff"
|
||||
)
|
||||
|
||||
# Fonts to consider:
|
||||
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
|
||||
|
@ -2190,7 +2217,7 @@ server <- function(input, output, session) {
|
|||
ds = NULL,
|
||||
input = exists("webResearch_data"),
|
||||
local_temp = NULL,
|
||||
quarto = NULL,
|
||||
ready = NULL,
|
||||
test = "no",
|
||||
data_original = NULL,
|
||||
data = NULL,
|
||||
|
@ -2562,6 +2589,8 @@ server <- function(input, output, session) {
|
|||
|
||||
# patchwork::wrap_plots(ncol=1) +
|
||||
# patchwork::plot_annotation(title = 'Multivariable regression model checks')
|
||||
|
||||
rv$ready <- "ready"
|
||||
})
|
||||
}
|
||||
)
|
||||
|
@ -2588,6 +2617,15 @@ server <- function(input, output, session) {
|
|||
|
||||
shiny::outputOptions(output, "uploaded", suspendWhenHidden = FALSE)
|
||||
|
||||
output$ready <- shiny::reactive({
|
||||
if (is.null(rv$ready)) {
|
||||
"no"
|
||||
} else {
|
||||
"yes"
|
||||
}
|
||||
})
|
||||
|
||||
shiny::outputOptions(output, "ready", suspendWhenHidden = FALSE)
|
||||
|
||||
# Reimplement from environment at later time
|
||||
# output$has_input <- shiny::reactive({
|
||||
|
@ -2610,7 +2648,7 @@ server <- function(input, output, session) {
|
|||
content = function(file, type = input$output_type) {
|
||||
## Notification is not progressing
|
||||
## Presumably due to missing
|
||||
shiny::withProgress(message = "Generating report. Hold on for a moment..", {
|
||||
shiny::withProgress(message = "Generating the report. Hold on for a moment..", {
|
||||
rv$list |>
|
||||
write_quarto(
|
||||
output_format = type,
|
||||
|
|
|
@ -5,6 +5,6 @@ account: agdamsbo
|
|||
server: shinyapps.io
|
||||
hostUrl: https://api.shinyapps.io/v1
|
||||
appId: 13611288
|
||||
bundleId: 9533633
|
||||
bundleId:
|
||||
url: https://agdamsbo.shinyapps.io/freesearcheR/
|
||||
version: 1
|
||||
|
|
|
@ -64,7 +64,7 @@ server <- function(input, output, session) {
|
|||
ds = NULL,
|
||||
input = exists("webResearch_data"),
|
||||
local_temp = NULL,
|
||||
quarto = NULL,
|
||||
ready = NULL,
|
||||
test = "no",
|
||||
data_original = NULL,
|
||||
data = NULL,
|
||||
|
@ -436,6 +436,8 @@ server <- function(input, output, session) {
|
|||
|
||||
# patchwork::wrap_plots(ncol=1) +
|
||||
# patchwork::plot_annotation(title = 'Multivariable regression model checks')
|
||||
|
||||
rv$ready <- "ready"
|
||||
})
|
||||
}
|
||||
)
|
||||
|
@ -462,6 +464,15 @@ server <- function(input, output, session) {
|
|||
|
||||
shiny::outputOptions(output, "uploaded", suspendWhenHidden = FALSE)
|
||||
|
||||
output$ready <- shiny::reactive({
|
||||
if (is.null(rv$ready)) {
|
||||
"no"
|
||||
} else {
|
||||
"yes"
|
||||
}
|
||||
})
|
||||
|
||||
shiny::outputOptions(output, "ready", suspendWhenHidden = FALSE)
|
||||
|
||||
# Reimplement from environment at later time
|
||||
# output$has_input <- shiny::reactive({
|
||||
|
@ -484,7 +495,7 @@ server <- function(input, output, session) {
|
|||
content = function(file, type = input$output_type) {
|
||||
## Notification is not progressing
|
||||
## Presumably due to missing
|
||||
shiny::withProgress(message = "Generating report. Hold on for a moment..", {
|
||||
shiny::withProgress(message = "Generating the report. Hold on for a moment..", {
|
||||
rv$list |>
|
||||
write_quarto(
|
||||
output_format = type,
|
||||
|
|
|
@ -225,10 +225,35 @@ ui_elements <- list(
|
|||
class = "fa-spin",
|
||||
"aria-hidden" = "true"
|
||||
),
|
||||
type = "primary",
|
||||
type = "secondary",
|
||||
auto_reset = TRUE
|
||||
),
|
||||
shiny::helpText("If you change the parameters, press 'Analyse' again to update the tables")
|
||||
shiny::helpText("If you change the parameters, press 'Analyse' again to update the tables"),
|
||||
# shiny::conditionalPanel(
|
||||
# condition = "output.ready=='yes'",
|
||||
shiny::tags$hr(),
|
||||
shiny::h4("Download results"),
|
||||
shiny::helpText("Choose your favourite output file format for further work, and download, when the analyses are done."),
|
||||
shiny::selectInput(
|
||||
inputId = "output_type",
|
||||
label = "Output format",
|
||||
selected = NULL,
|
||||
choices = list(
|
||||
"Word" = "docx",
|
||||
"LibreOffice" = "odt"
|
||||
# ,
|
||||
# "PDF" = "pdf",
|
||||
# "All the above" = "all"
|
||||
)
|
||||
),
|
||||
shiny::br(),
|
||||
# Button
|
||||
shiny::downloadButton(
|
||||
outputId = "report",
|
||||
label = "Download",
|
||||
icon = shiny::icon("download")
|
||||
)
|
||||
# )
|
||||
# )
|
||||
),
|
||||
bslib::nav_panel(
|
||||
|
@ -260,8 +285,10 @@ ui_elements <- list(
|
|||
|
||||
# Initial attempt at creating light and dark versions
|
||||
light <- custom_theme()
|
||||
dark <- custom_theme(bg = "#000",
|
||||
fg="#fff")
|
||||
dark <- custom_theme(
|
||||
bg = "#000",
|
||||
fg = "#fff"
|
||||
)
|
||||
|
||||
# Fonts to consider:
|
||||
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
|
||||
|
|
|
@ -16,6 +16,7 @@ params:
|
|||
web_data <- readr::read_rds(file = params$data.file)
|
||||
library(gtsummary)
|
||||
library(gt)
|
||||
library(flextable)
|
||||
library(easystats)
|
||||
library(patchwork)
|
||||
# library(webResearch)
|
||||
|
@ -36,7 +37,9 @@ Below is the baseline characteristics plotted.
|
|||
```{r}
|
||||
#| label: tbl-baseline
|
||||
#| tbl-cap: Baseline characteristics of included data
|
||||
web_data$table1
|
||||
web_data$table1 |>
|
||||
gtsummary::as_flex_table() |>
|
||||
flextable::set_table_properties(width = 1, layout = "autofit")
|
||||
```
|
||||
|
||||
Here are the regression results.
|
||||
|
@ -44,9 +47,12 @@ Here are the regression results.
|
|||
```{r}
|
||||
#| label: tbl-regression
|
||||
#| tbl-cap: Regression analysis results
|
||||
web_data$table2
|
||||
web_data$table2|>
|
||||
gtsummary::as_flex_table() |>
|
||||
flextable::set_table_properties(width = 1, layout = "autofit")
|
||||
```
|
||||
|
||||
|
||||
## Discussion
|
||||
|
||||
Good luck on your further work!
|
||||
|
|
Loading…
Add table
Reference in a new issue