mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-09-12 18:09: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",
|
class = "fa-spin",
|
||||||
"aria-hidden" = "true"
|
"aria-hidden" = "true"
|
||||||
),
|
),
|
||||||
type = "primary",
|
type = "secondary",
|
||||||
auto_reset = TRUE
|
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(
|
bslib::nav_panel(
|
||||||
|
@ -2100,8 +2125,10 @@ ui_elements <- list(
|
||||||
|
|
||||||
# Initial attempt at creating light and dark versions
|
# Initial attempt at creating light and dark versions
|
||||||
light <- custom_theme()
|
light <- custom_theme()
|
||||||
dark <- custom_theme(bg = "#000",
|
dark <- custom_theme(
|
||||||
fg="#fff")
|
bg = "#000",
|
||||||
|
fg = "#fff"
|
||||||
|
)
|
||||||
|
|
||||||
# Fonts to consider:
|
# Fonts to consider:
|
||||||
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
|
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
|
||||||
|
@ -2190,7 +2217,7 @@ server <- function(input, output, session) {
|
||||||
ds = NULL,
|
ds = NULL,
|
||||||
input = exists("webResearch_data"),
|
input = exists("webResearch_data"),
|
||||||
local_temp = NULL,
|
local_temp = NULL,
|
||||||
quarto = NULL,
|
ready = NULL,
|
||||||
test = "no",
|
test = "no",
|
||||||
data_original = NULL,
|
data_original = NULL,
|
||||||
data = NULL,
|
data = NULL,
|
||||||
|
@ -2562,6 +2589,8 @@ server <- function(input, output, session) {
|
||||||
|
|
||||||
# patchwork::wrap_plots(ncol=1) +
|
# patchwork::wrap_plots(ncol=1) +
|
||||||
# patchwork::plot_annotation(title = 'Multivariable regression model checks')
|
# 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)
|
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
|
# Reimplement from environment at later time
|
||||||
# output$has_input <- shiny::reactive({
|
# output$has_input <- shiny::reactive({
|
||||||
|
@ -2610,7 +2648,7 @@ server <- function(input, output, session) {
|
||||||
content = function(file, type = input$output_type) {
|
content = function(file, type = input$output_type) {
|
||||||
## Notification is not progressing
|
## Notification is not progressing
|
||||||
## Presumably due to missing
|
## 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 |>
|
rv$list |>
|
||||||
write_quarto(
|
write_quarto(
|
||||||
output_format = type,
|
output_format = type,
|
||||||
|
|
|
@ -5,6 +5,6 @@ account: agdamsbo
|
||||||
server: shinyapps.io
|
server: shinyapps.io
|
||||||
hostUrl: https://api.shinyapps.io/v1
|
hostUrl: https://api.shinyapps.io/v1
|
||||||
appId: 13611288
|
appId: 13611288
|
||||||
bundleId: 9533633
|
bundleId:
|
||||||
url: https://agdamsbo.shinyapps.io/freesearcheR/
|
url: https://agdamsbo.shinyapps.io/freesearcheR/
|
||||||
version: 1
|
version: 1
|
||||||
|
|
|
@ -64,7 +64,7 @@ server <- function(input, output, session) {
|
||||||
ds = NULL,
|
ds = NULL,
|
||||||
input = exists("webResearch_data"),
|
input = exists("webResearch_data"),
|
||||||
local_temp = NULL,
|
local_temp = NULL,
|
||||||
quarto = NULL,
|
ready = NULL,
|
||||||
test = "no",
|
test = "no",
|
||||||
data_original = NULL,
|
data_original = NULL,
|
||||||
data = NULL,
|
data = NULL,
|
||||||
|
@ -436,6 +436,8 @@ server <- function(input, output, session) {
|
||||||
|
|
||||||
# patchwork::wrap_plots(ncol=1) +
|
# patchwork::wrap_plots(ncol=1) +
|
||||||
# patchwork::plot_annotation(title = 'Multivariable regression model checks')
|
# 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)
|
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
|
# Reimplement from environment at later time
|
||||||
# output$has_input <- shiny::reactive({
|
# output$has_input <- shiny::reactive({
|
||||||
|
@ -484,7 +495,7 @@ server <- function(input, output, session) {
|
||||||
content = function(file, type = input$output_type) {
|
content = function(file, type = input$output_type) {
|
||||||
## Notification is not progressing
|
## Notification is not progressing
|
||||||
## Presumably due to missing
|
## 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 |>
|
rv$list |>
|
||||||
write_quarto(
|
write_quarto(
|
||||||
output_format = type,
|
output_format = type,
|
||||||
|
|
|
@ -225,10 +225,35 @@ ui_elements <- list(
|
||||||
class = "fa-spin",
|
class = "fa-spin",
|
||||||
"aria-hidden" = "true"
|
"aria-hidden" = "true"
|
||||||
),
|
),
|
||||||
type = "primary",
|
type = "secondary",
|
||||||
auto_reset = TRUE
|
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(
|
bslib::nav_panel(
|
||||||
|
@ -260,8 +285,10 @@ ui_elements <- list(
|
||||||
|
|
||||||
# Initial attempt at creating light and dark versions
|
# Initial attempt at creating light and dark versions
|
||||||
light <- custom_theme()
|
light <- custom_theme()
|
||||||
dark <- custom_theme(bg = "#000",
|
dark <- custom_theme(
|
||||||
fg="#fff")
|
bg = "#000",
|
||||||
|
fg = "#fff"
|
||||||
|
)
|
||||||
|
|
||||||
# Fonts to consider:
|
# Fonts to consider:
|
||||||
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
|
# https://webdesignerdepot.com/17-open-source-fonts-youll-actually-love/
|
||||||
|
|
|
@ -16,6 +16,7 @@ params:
|
||||||
web_data <- readr::read_rds(file = params$data.file)
|
web_data <- readr::read_rds(file = params$data.file)
|
||||||
library(gtsummary)
|
library(gtsummary)
|
||||||
library(gt)
|
library(gt)
|
||||||
|
library(flextable)
|
||||||
library(easystats)
|
library(easystats)
|
||||||
library(patchwork)
|
library(patchwork)
|
||||||
# library(webResearch)
|
# library(webResearch)
|
||||||
|
@ -36,7 +37,9 @@ Below is the baseline characteristics plotted.
|
||||||
```{r}
|
```{r}
|
||||||
#| label: tbl-baseline
|
#| label: tbl-baseline
|
||||||
#| tbl-cap: Baseline characteristics of included data
|
#| 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.
|
Here are the regression results.
|
||||||
|
@ -44,9 +47,12 @@ Here are the regression results.
|
||||||
```{r}
|
```{r}
|
||||||
#| label: tbl-regression
|
#| label: tbl-regression
|
||||||
#| tbl-cap: Regression analysis results
|
#| tbl-cap: Regression analysis results
|
||||||
web_data$table2
|
web_data$table2|>
|
||||||
|
gtsummary::as_flex_table() |>
|
||||||
|
flextable::set_table_properties(width = 1, layout = "autofit")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Discussion
|
## Discussion
|
||||||
|
|
||||||
Good luck on your further work!
|
Good luck on your further work!
|
||||||
|
|
Loading…
Add table
Reference in a new issue