From 4a0fdb73ffd97ad3069f8072c9fd2cc430a87d34 Mon Sep 17 00:00:00 2001 From: Krystian Igras Date: Fri, 11 Oct 2024 11:19:42 +0000 Subject: [PATCH 1/3] Fix glue revdep error. --- DESCRIPTION | 2 +- NEWS.md | 4 ++++ README.md | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b1ea3b0..9d42848 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: shinyCohortBuilder Type: Package Title: Modular Cohort-Building Framework for Analytical Dashboards -Version: 0.3.0 +Version: 0.3.1 Authors@R: c(person('Krystian', 'Igras', email = 'krystian8207@gmail.com', diff --git a/NEWS.md b/NEWS.md index 1849b01..ab770f1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# shinyCohortBuilder 0.3.1 + +* Fix compatibility with latest version of glue package (#61) + # shinyCohortBuilder 0.3.0 * Most of the modals have now `easyClosed` option turned on (#25). diff --git a/README.md b/README.md index 79a6fd2..e49dfe4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ workflow to Shiny. ![](man/figures/doc_01.gif) -[![version](https://img.shields.io/static/v1.svg?label=github.com&message=v.0.3.0&color=ff69b4)](https://r-world-devs.github.io/shinyCohortBuilder/) +[![version](https://img.shields.io/static/v1.svg?label=github.com&message=v.0.3.1&color=ff69b4)](https://r-world-devs.github.io/shinyCohortBuilder/) [![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) ## Installation From 2897b060d2c7ccbc04a0a9e158a5b6b545d7ce7d Mon Sep 17 00:00:00 2001 From: Krystian Igras Date: Fri, 11 Oct 2024 11:25:44 +0000 Subject: [PATCH 2/3] Move glue vars pre function calling. --- R/filter_discrete.R | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/R/filter_discrete.R b/R/filter_discrete.R index ad94056..4d41474 100644 --- a/R/filter_discrete.R +++ b/R/filter_discrete.R @@ -31,30 +31,28 @@ choice_name <- function(name, parent_stat, current_stat, stats) { #' @export .pre_post_stats_text <- function(current, previous, name, brackets = TRUE, percent = FALSE, stats = c("pre", "post")) { + name <- empty_if_false(!missing(name), paste0(name, " "), FALSE, "") + open_bracket <- empty_if_false(brackets && any(stats %in% c("pre", "post")), "(", FALSE, "") + post_stat <- empty_if_false( + "post" %in% stats, + glue::glue("{current}"), + FALSE, "" + ) + slash <- empty_if_false(length(stats) == 2, " / ", FALSE, "") + pre_stat <- empty_if_false("pre" %in% stats, previous, FALSE, "") + close_bracket <- empty_if_false(brackets && any(stats %in% c("pre", "post")), ")", FALSE, "") + percent_open_bracket <- empty_if_false(percent && length(stats) == 2, " (", FALSE, "") + percent <- empty_if_false( + percent && length(stats) == 2, + glue::glue("{round(100 * current / previous, 0)}%"), + FALSE, "" + ) + percent_close_bracket = empty_if_false(percent && length(stats) == 2, ")", FALSE, "") glue::glue( "", "{name}{open_bracket}{post_stat}{slash}{pre_stat}{close_bracket}", "{percent_open_bracket}{percent}{percent_close_bracket}", - "", - .envir = list( - name = empty_if_false(!missing(name), paste0(name, " "), FALSE, ""), - open_bracket = empty_if_false(brackets && any(stats %in% c("pre", "post")), "(", FALSE, ""), - post_stat = empty_if_false( - "post" %in% stats, - glue::glue("{current}"), - FALSE, "" - ), - slash = empty_if_false(length(stats) == 2, " / ", FALSE, ""), - pre_stat = empty_if_false("pre" %in% stats, previous, FALSE, ""), - close_bracket = empty_if_false(brackets && any(stats %in% c("pre", "post")), ")", FALSE, ""), - percent_open_bracket = empty_if_false(percent && length(stats) == 2, " (", FALSE, ""), - percent = empty_if_false( - percent && length(stats) == 2, - glue::glue("{round(100 * current / previous, 0)}%"), - FALSE, "" - ), - percent_close_bracket = empty_if_false(percent && length(stats) == 2, ")", FALSE, "") - ) + "" ) } From 5109c01887f7a407e511ddb9f20b626aa325ec5e Mon Sep 17 00:00:00 2001 From: Krystian Igras Date: Fri, 11 Oct 2024 13:51:24 +0000 Subject: [PATCH 3/3] Properly handle stats percentage. --- R/filter_discrete.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/filter_discrete.R b/R/filter_discrete.R index 4d41474..f6476f8 100644 --- a/R/filter_discrete.R +++ b/R/filter_discrete.R @@ -42,16 +42,16 @@ choice_name <- function(name, parent_stat, current_stat, stats) { pre_stat <- empty_if_false("pre" %in% stats, previous, FALSE, "") close_bracket <- empty_if_false(brackets && any(stats %in% c("pre", "post")), ")", FALSE, "") percent_open_bracket <- empty_if_false(percent && length(stats) == 2, " (", FALSE, "") - percent <- empty_if_false( + percentage <- empty_if_false( percent && length(stats) == 2, glue::glue("{round(100 * current / previous, 0)}%"), FALSE, "" ) - percent_close_bracket = empty_if_false(percent && length(stats) == 2, ")", FALSE, "") + percent_close_bracket <- empty_if_false(percent && length(stats) == 2, ")", FALSE, "") glue::glue( "", "{name}{open_bracket}{post_stat}{slash}{pre_stat}{close_bracket}", - "{percent_open_bracket}{percent}{percent_close_bracket}", + "{percent_open_bracket}{percentage}{percent_close_bracket}", "" ) }