From 0feee4f02b0015194754cb959ea33cfe04332b90 Mon Sep 17 00:00:00 2001 From: Andreas Gammelgaard Damsbo Date: Wed, 26 Mar 2025 12:07:28 +0100 Subject: [PATCH] fixed data_description bug --- R/app_version.R | 2 +- R/helpers.R | 13 +++++++++---- inst/apps/FreesearchR/app.R | 19 ++++++++++++------- .../shinyapps.io/agdamsbo/freesearcheR.dcf | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/R/app_version.R b/R/app_version.R index b5243e9..9054157 100644 --- a/R/app_version.R +++ b/R/app_version.R @@ -1 +1 @@ -app_version <- function()'250324_1432' +app_version <- function()'250326_1206' diff --git a/R/helpers.R b/R/helpers.R index 9696823..a15a54a 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -329,11 +329,16 @@ missing_fraction <- function(data) { data_description <- function(data) { data <- if (shiny::is.reactive(data)) data() else data + n <- nrow(data) + n_var <- ncol(data) + n_complete <- sum(complete.cases(data)) + p_complete <- n_complete/n + sprintf( i18n("Data has %s observations and %s variables, with %s (%s%%) complete cases"), - nrow(data), - ncol(data), - sum(complete.cases(data)), - signif(100 * (1 - missing_fraction(data)), 3) + n, + n_var, + n_complete, + signif(100 * p_complete, 3) ) } diff --git a/inst/apps/FreesearchR/app.R b/inst/apps/FreesearchR/app.R index 1dbfff5..24b4e8d 100644 --- a/inst/apps/FreesearchR/app.R +++ b/inst/apps/FreesearchR/app.R @@ -10,7 +10,7 @@ #### Current file: R//app_version.R ######## -app_version <- function()'250324_1432' +app_version <- function()'250326_1206' ######## @@ -2817,12 +2817,17 @@ missing_fraction <- function(data) { data_description <- function(data) { data <- if (shiny::is.reactive(data)) data() else data + n <- nrow(data) + n_var <- ncol(data) + n_complete <- sum(complete.cases(data)) + p_complete <- n_complete/n + sprintf( i18n("Data has %s observations and %s variables, with %s (%s%%) complete cases"), - nrow(data), - ncol(data), - sum(complete.cases(data)), - signif(100 * (1 - missing_fraction(data)), 3) + n, + n_var, + n_complete, + signif(100 * p_complete, 3) ) } @@ -3474,7 +3479,7 @@ plot_box <- function(data, x, y, z = NULL) { #' #' @name data-plots #' -#' @returns +#' @returns ggplot object #' @export #' #' @examples @@ -5444,7 +5449,7 @@ limit_log <- function(data, fun, ...) { #' #' @param data numeric vector #' -#' @returns +#' @returns numeric vector #' @export #' #' @examples diff --git a/inst/apps/FreesearchR/rsconnect/shinyapps.io/agdamsbo/freesearcheR.dcf b/inst/apps/FreesearchR/rsconnect/shinyapps.io/agdamsbo/freesearcheR.dcf index ce7c605..bce11d6 100644 --- a/inst/apps/FreesearchR/rsconnect/shinyapps.io/agdamsbo/freesearcheR.dcf +++ b/inst/apps/FreesearchR/rsconnect/shinyapps.io/agdamsbo/freesearcheR.dcf @@ -5,6 +5,6 @@ account: agdamsbo server: shinyapps.io hostUrl: https://api.shinyapps.io/v1 appId: 13611288 -bundleId: 9994253 +bundleId: 9994404 url: https://agdamsbo.shinyapps.io/freesearcheR/ version: 1