mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 04:27:30 +02:00
latest version render
This commit is contained in:
parent
346bc7edf7
commit
8db847b43d
28 changed files with 397 additions and 107 deletions
|
|
@ -1 +1 @@
|
|||
app_version <- function()'25.10.1'
|
||||
app_version <- function()'25.10.2'
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
hosted_version <- function()'v25.10.1-251002'
|
||||
hosted_version <- function()'v25.10.2-251007'
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ import_file_ui <- function(id,
|
|||
shiny::tags$b(i18n$t("No file selected.")),
|
||||
# shiny::textOutput(ns("trans_format_text")),
|
||||
# This is the easiest solution, though not gramatically perfect
|
||||
i18n$t("You can choose between these file types:"), paste(file_extensions,collapse=', '),
|
||||
i18n$t("You can choose between these file types:"), paste(file_extensions, collapse = ", "),
|
||||
# sprintf("You can import %s files", paste(file_extensions, collapse = ", ")),
|
||||
dismissible = TRUE
|
||||
)
|
||||
|
|
@ -177,7 +177,8 @@ import_file_server <- function(id,
|
|||
show_data_in = c("popup", "modal"),
|
||||
trigger_return = c("button", "change"),
|
||||
return_class = c("data.frame", "data.table", "tbl_df", "raw"),
|
||||
reset = reactive(NULL)) {
|
||||
reset = reactive(NULL),
|
||||
limit=100000) {
|
||||
read_fns <- list(
|
||||
ods = "import_ods",
|
||||
dta = "import_dta",
|
||||
|
|
@ -296,6 +297,10 @@ import_file_server <- function(id,
|
|||
extra = if (isTRUE(input$preview_data)) i18n$t("First five rows are shown below:")
|
||||
)
|
||||
)
|
||||
|
||||
## As a protective measure, the dataset size is capped at cell limit
|
||||
imported <- limit_data_size(imported,limit = limit)
|
||||
|
||||
temporary_rv$status <- "success"
|
||||
temporary_rv$data <- imported
|
||||
temporary_rv$name <- input$file$name
|
||||
|
|
@ -508,9 +513,9 @@ import_rds <- function(file) {
|
|||
file = file
|
||||
)
|
||||
|
||||
if (is.data.frame(out)){
|
||||
if (is.data.frame(out)) {
|
||||
out
|
||||
} else if (is.vector(out) && !is.null(dim(out))){
|
||||
} else if (is.vector(out) && !is.null(dim(out))) {
|
||||
## If the data is a simple vector (simple test), it is coerced to a data.frame
|
||||
as.data.frame(out)
|
||||
} else {
|
||||
|
|
@ -621,3 +626,39 @@ import_file_demo_app <- function() {
|
|||
}
|
||||
shiny::shinyApp(ui, server)
|
||||
}
|
||||
|
||||
|
||||
#' Limit the allowed data set size by number of cells
|
||||
#'
|
||||
#' @description
|
||||
#' This function may act to guard a hosted app against very large data sets in
|
||||
#' addition to the file size limitations.
|
||||
#' The function will limit the data set by dropping rows.
|
||||
#'
|
||||
#'
|
||||
#' @param data data.frame
|
||||
#' @param limit cell number limit. Default is NULL.
|
||||
#'
|
||||
#' @returns data.frame
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#' prod(dim(mtcars))
|
||||
#' limit_data_size(mtcars)
|
||||
#' limit_data_size(mtcars,100)
|
||||
limit_data_size <- function(data, limit = NULL) {
|
||||
## Add security to only allow dataset of 100.000 cells
|
||||
## Ideally this should only go for the hosted version
|
||||
|
||||
if (is.null(limit)){
|
||||
return(data)
|
||||
}
|
||||
|
||||
data_dim <- dim(data)
|
||||
|
||||
if (prod(data_dim) > limit) {
|
||||
head(data, floor(limit / data_dim[2]))
|
||||
} else {
|
||||
data
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
|
|
@ -376,7 +376,7 @@ ui_elements <- function(selection) {
|
|||
"Yes" = "yes"
|
||||
)
|
||||
),
|
||||
shiny::helpText("Option to perform statistical comparisons between strata in baseline table.")
|
||||
shiny::helpText(i18n$t("Option to perform statistical comparisons between strata in baseline table."))
|
||||
),
|
||||
shiny::br(),
|
||||
shiny::br(),
|
||||
|
|
@ -386,7 +386,8 @@ ui_elements <- function(selection) {
|
|||
width = "100%",
|
||||
icon = shiny::icon("calculator"),
|
||||
disabled = TRUE
|
||||
)
|
||||
),
|
||||
shiny::helpText(i18n$t("Press 'Evaluate' to create the comparison table."))
|
||||
)
|
||||
)
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue