From fb08fbfaa52a1deb531cb704a79e8dfac9e2b867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:38:23 +0000 Subject: [PATCH 01/31] feat: tm_g_scatterplot --- R/tm_g_scatterplot.R | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 3e3f69de4..ec834e9b4 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -307,7 +307,16 @@ tm_g_scatterplot <- function(label = "Scatterplot", checkmate::assert_scalar(table_dec) checkmate::assert_class(ggplot2_args, "ggplot2_args") - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) + # End of assertions # Make UI args @@ -430,7 +439,7 @@ ui_g_scatterplot <- function(id, ...) { is_single_dataset = is_single_dataset_value ) }, - ui_transform_teal_data(ns("decorator"), transformators = args$decorators), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -1005,12 +1014,14 @@ srv_g_scatterplot <- function(id, teal.code::eval_code(plot_q, plot_call) }) - decorated_output_q <- srv_transform_teal_data(id = "decorator", data = output_q, transformators = decorators) - decorated_output_plot_q <- reactive(within(decorated_output_q(), print(plot))) - plot_r <- reactive({ - req(output_q()) # Ensure original errors are displayed - decorated_output_plot_q()[["plot"]] - }) + decorated_output_plot_q <- srv_decorate_teal_data( + id = "decorator", + data = output_q, + decorators = subset_decorators("plot", decorators), + expr = print(plot) + ) + + plot_r <- reactive(req(decorated_output_plot_q())[["plot"]]) # Insert the plot into a plot_with_settings module from teal.widgets pws <- teal.widgets::plot_with_settings_srv( From 82aeea5526086597fdfc58cb26eaaa04a3f94f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:52:15 +0000 Subject: [PATCH 02/31] feat: tm_a_pca --- R/tm_a_pca.R | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 9cccffe02..1e26cd571 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -165,7 +165,14 @@ tm_a_pca <- function(label = "Principal Component Analysis", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) # End of assertions # Make UI args @@ -240,7 +247,7 @@ ui_a_pca <- function(id, ...) { choices = args$plot_choices, selected = args$plot_choices[1] ), - ui_transform_teal_data(ns("decorate"), transformators = args$decorators) + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)) ), teal.widgets::panel_item( title = "Pre-processing", @@ -975,13 +982,14 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl ) }) - decorated_output_q_no_print <- srv_transform_teal_data("decorate", data = output_q, transformators = decorators) - decorated_output_q <- reactive(within(decorated_output_q_no_print(), expr = print(plot))) + decorated_output_q <- srv_decorate_teal_data( + id = "decorator", + data = output_q, + decorators = subset_decorators("plot", decorators), + expr = print(plot) + ) - plot_r <- reactive({ - req(output_q()) - decorated_output_q()[["plot"]] - }) + plot_r <- reactive(req(decorated_output_q())[["plot"]]) pws <- teal.widgets::plot_with_settings_srv( id = "pca_plot", From 6561d03b363f7eaa2b2eed208dc0e19bec873cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:58:38 +0000 Subject: [PATCH 03/31] feat: allow expression to be output of reactive --- R/utils.R | 8 ++++++-- man/srv_decorate_teal_data.Rd | 4 +++- man/tm_a_pca.Rd | 8 ++++---- man/tm_a_regression.Rd | 8 ++++---- man/tm_data_table.Rd | 8 ++++---- man/tm_file_viewer.Rd | 4 ++-- man/tm_front_page.Rd | 4 ++-- man/tm_g_association.Rd | 8 ++++---- man/tm_g_bivariate.Rd | 8 ++++---- man/tm_g_distribution.Rd | 8 ++++---- man/tm_g_response.Rd | 8 ++++---- man/tm_g_scatterplot.Rd | 8 ++++---- man/tm_g_scatterplotmatrix.Rd | 8 ++++---- man/tm_missing_data.Rd | 8 ++++---- man/tm_outliers.Rd | 8 ++++---- man/tm_t_crosstable.Rd | 8 ++++---- man/tm_variable_browser.Rd | 8 ++++---- 17 files changed, 65 insertions(+), 59 deletions(-) diff --git a/R/utils.R b/R/utils.R index 750911a6a..477bb7400 100644 --- a/R/utils.R +++ b/R/utils.R @@ -286,6 +286,7 @@ assert_single_selection <- function(x, #' @param expr (`expression` or `reactive`) to evaluate on the output of the decoration. #' When an expression it must be inline code. See [within()] #' Default is `NULL` which won't evaluate any appending code. +#' @param expr_is_reactive () #' @details #' `srv_decorate_teal_data` is a wrapper around `srv_transform_teal_data` that #' allows to decorate the data with additional expressions. @@ -293,12 +294,13 @@ assert_single_selection <- function(x, #' first. #' #' @keywords internal -srv_decorate_teal_data <- function(id, data, decorators, expr) { +srv_decorate_teal_data <- function(id, data, decorators, expr, expr_is_reactive = FALSE) { assert_reactive(data) checkmate::assert_list(decorators, "teal_transform_module") + checkmate::assert_factor(expr_is_reactive) missing_expr <- missing(expr) - if (!missing_expr) { + if (!missing_expr && !expr_is_reactive) { expr <- rlang::enexpr(expr) } @@ -310,6 +312,8 @@ srv_decorate_teal_data <- function(id, data, decorators, expr) { req(data(), decorated_output()) if (missing_expr) { decorated_output() + } else if (expr_is_reactive) { + eval_code(decorated_output(), expr()) } else { eval_code(decorated_output(), expr) } diff --git a/man/srv_decorate_teal_data.Rd b/man/srv_decorate_teal_data.Rd index 6d6845aca..6ed8a4399 100644 --- a/man/srv_decorate_teal_data.Rd +++ b/man/srv_decorate_teal_data.Rd @@ -5,7 +5,7 @@ \alias{ui_decorate_teal_data} \title{Wrappers around \code{srv_transform_teal_data} that allows to decorate the data} \usage{ -srv_decorate_teal_data(id, data, decorators, expr) +srv_decorate_teal_data(id, data, decorators, expr, expr_is_reactive = FALSE) ui_decorate_teal_data(id, decorators, ...) } @@ -17,6 +17,8 @@ ui_decorate_teal_data(id, decorators, ...) \item{expr}{(\code{expression} or \code{reactive}) to evaluate on the output of the decoration. When an expression it must be inline code. See \code{\link[=within]{within()}} Default is \code{NULL} which won't evaluate any appending code.} + +\item{expr_is_reactive}{()} } \description{ Wrappers around \code{srv_transform_teal_data} that allows to decorate the data diff --git a/man/tm_a_pca.Rd b/man/tm_a_pca.Rd index 5ed58485a..f5d2d052c 100644 --- a/man/tm_a_pca.Rd +++ b/man/tm_a_pca.Rd @@ -167,13 +167,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokrcQAxLqkQ11XfxQpFC6cAAesKgiSoHBBsZc1AD6sVA2MUEhRroA7rSkABYq7Km4uiBKurqMcACOgrQ17L6ipMTURIyKEFWOAMoAgow1raLxuv1DI6SiSgC+3UpoqOMq+eyVAZm6ALxbwbibfEIiY3vHwmIbPVW6pDBJUEmoBGmbt7oKYAAKAMIDX0ONw+sV2+ye4VIzA0SVEqDgBGuHxBmWg8DBX0mwzEM0B72RojgIg0YMJxNIsPhiPxyN0BAKRFoBDEYK0LFoUHoIiS9MZzNESNpyNSYNSwGAmMG2NGXwAurKytSwABZQSMfgyQGfMADUSiKDCUhazGMehQCDfIioY1gLBoOBfbpC25yIHOqpkhHkfhgpWq9WavDa3X6w2Ot3umCG2hRPR7BwuGkuiO0ky0ajkRhggByjgAMnmk06XZtut1aCZdOwVJn1JodDZbBUbqIihBWAN0OxlgASBplXuExg6LrzJRgOayoA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokrcQAxLoDCAEQCSAMreuvxQpFC6cAAesKgiSmERBsZc1AD6SVA2ieGRRroA7rSkABYq7Fm4uiBKurqMcACOgrSN7BBipMTURIyKEPUAgr6BADIpDSPjSgC+AwBWRCrpANZwrKKVebYF-HAmUMKk6QT8tKIE6Usr65vA0PBbWXIAuu5oqJMqJex1oXldABeAERXD-PhCESiYG6SHCMR-Qb1XSkGDpKDpVAEbL-FG6BRgAAK3iGhPByPxSVhWXSMVIzA06VEqDgBCR+KpeUeehBhOmY3JeM5ojgIg0sNF4pOLLZHM5+IIpWWBDEsK0LFoUHoIlOytoqq2woV9SyNLywGA-NGgrAr1e1XZhIAQgBZLAAaSwAEZyQSwEMAOKuPD+5wAeUCvgAmoSBiaUXIKQn6lK2eR+LCnWA3Z6fX7+cG48mUzBjrR4rz7E5XJTOUnjSiTLRqORGLCAHKOMaCuv1eOJ-4DAa0Ey6dgqNvqTQ6Gy2WrI0TlCCsIbodifAAkrWqW9FjB0-TmSjAs1eQA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_a_regression.Rd b/man/tm_a_regression.Rd index 29399feae..868e6562a 100644 --- a/man/tm_a_regression.Rd +++ b/man/tm_a_regression.Rd @@ -212,13 +212,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokrcQAxLqkQ11XfxQpFC6cAAesKgiSoHBBsZc1AD6sVA2MUEhRroA7rSkABYq7Km4uiBKurqMcACOgrQ17L6ipMTURIyKEFUAwgDyAEzxugODSgC+3UpoqCMq+eyVAZm6ALwrwbjLfEIiouu6u8JiSz1VuqQwSVBJNRI1oqJWEGcXF9RQ9HD+GwpgWDgDzEzxI-2253ej1QJFEeg2qSS4VIzA0SVEqDgBDe7wuqWg8EO-zG4OWuN0cJEGkOlKxpHRmOxZPJuk+31+un+AGUfnTdFoWLQviJEKTISyCAUiLQCGIiWBBKhggBrOBilkXWkaOD8eWKlVqvDM8kwYSaKLw3QAMQAggAZLnOCEaqomWhhHWHBwuY0XbrkuTO3H3R6iTqHRHI1H0jFYnHk-GwS3Eobqlla0g03lo2NM8Xktk-eU8qmZgWMIX0faio353GS6Wyg4bcuVkRJBsy06pYDAFPjMAAXUHZSZhBIBHBnLAdhqQXgZH+ckDvveGc9f3HFjTGtN1HNIi9Tidq4ubo9uo2todrjrVX9uIf9+W3W6tBMunYKnI0e0cBstgVOcohFBArA2ug7CzAAJA0ZQwXCjA6F0kxKGAEyDkAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYGkoGkGhIGqJRFYIIjkcjqFB6HBqDCFGAsHBsWI8SQqWCkUScagSKI9MDMmloqRmBo0qJUHACISicjMg8uboqVNRky-hLdJyRBoYarRcdhaLxcq6iSyRTgVSAuStbotCxaKSRIhFSz9QQSksCGJKWAAEIAWSwAGksABGB365GajRwfgen3+oMh0Owo60OIygBig1GAWczITploUUjMIcLiVEv6yrkOYlWJxol6MJ5fIF2pFYtLRKlsBlcpGCrw7bD5vVwPDLd1A6JhvJHrNatIluttrE9v7juVztd7uBVsYNvoIhOLtobqeuWAwB70zALxeVTbYEGAHFXHhZWAswANJlvrCDLwvuRKwnQc50LE0H2feNQxgJMUyLJxs2AuoTHzMDdHTTNXDXZFyzLUtcP6fpaBMXR2BUchm20OAbFsGokVEMoIFYQZ0HYNBUAAEhaKp2I4zlGB0PpZiUMAZheIA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_data_table.Rd b/man/tm_data_table.Rd index af43a7d14..5661eb2ee 100644 --- a/man/tm_data_table.Rd +++ b/man/tm_data_table.Rd @@ -126,13 +126,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlQ20onG6vaJKAL5dSmioAyp57BX+GboAvAtBuPN8QiL9K5vCYnPdlbqkMMkZiUH0IofHx1ostFDXYomicCIacPzLunQttzuxyGvwIczAAGU4KhuBgADIUCQFBR4XQoqEwngAdVo-GRqJRAAU4EEeAiIEj8ijSkSSbCcXiqQTIag4ARaGIUV0gbo5Osjnc8YkWBIdn8+qR2AQ0JoSL8UQBJLAKiH2Z4iXQAYRlVggXPmlW5vKUXVoJl07BU5GYlh0Nls5SOokKEFYAEF0OxJgASeqlH3vRg6TqjJRgEYAXSAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYBlcmlwvQRIjkcitCxaFBsWI0qI4CINHB+DC6KJSOwpuNgQRfmAAnZHD4AJp+HwKPC6AWOAKOABCACk+QKqgLRZLpYK5X47M5FbKwIMAOKuJXs5wADQFcjkYKReP4xxYEmhwLpDIIaE0JBhAqZ9mJIm8TqsEGNfzq-UDSn6tBMunYKnIzEsOhsthqSNEZQgrEG6HYaFQABIWlUs9nyYwdH1ZkowDMXkA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_file_viewer.Rd b/man/tm_file_viewer.Rd index a1617b9db..cf3b5cdd3 100644 --- a/man/tm_file_viewer.Rd +++ b/man/tm_file_viewer.Rd @@ -54,8 +54,8 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqX8opKAeNdqAfQ8vG3dPbyNdAHdaUgALFXYgqFxdECVdXSSfTLCME2Z4dgBGRQgAX1KlNFRslRj2dJyvXQBeJuTGviERUVbdLuExBogMjNIYfxNaEX8tWjhImWHR0ZVUQVJ-VE9YvrpRUmWV0ZMian4ZPtFWA7gYPOm4BrBRWFQZqZ6FPF1tggBrKBSPrfPy8ASDcRSCBqajfOS4RrHX4QCRXG7ke6fJ7fV4wd5wSaPUQAejxBKJIgwqFR3xSf0BwLaoLg3HB3TEkmksnhiJGyN0pAAHqR0bcsY9nuSPsSyW8ZVThaQ6b91Iy9MywGCBj0uTCeWAEUjjoJGNQQWBYqRSKhRIgSSSTB5JEQtI7ZfxGIIJKT1vR9rE4PwSQAFIiMLz+uCGAAiRAIgngZEMADFwzBPIYAMqoOAEWhTAieKwQcSofgmb7GjKlFa13SlUoF3TsFTkZiWHQ2WxpfmieIQVgAQXQ7GqABJBLQUhPRDIdIxSmUlGAygBdIA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_front_page.Rd b/man/tm_front_page.Rd index 7da5acb05..35b1c3e9d 100644 --- a/man/tm_front_page.Rd +++ b/man/tm_front_page.Rd @@ -85,8 +85,8 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqX8opKAeNdqAfQ8vG3dPbyNdAHdaUgALFXYgqFxdECVdXUY4AEdBWiz2CDFSYmoiRkUIDIBBABEAZQAZH0y6pvTdT1JGdjbGlIUweC8kwdsIulFSdkHqwTjywd0AXl1BgDlnertdLhhBgbAk-1EiQUYCOCXVwdFWMli4TQJdUbBKgF9KgCsiFX8ANZwViiRJhcbGfhwExQYSkfwEfi0UQEfy-f5AkHAaDwUFJOQAXTcZCg9BE-gAjC0khgTMx4OwAJIQExEFa6AgzMDVA5rMAAITGKTscAAHqR2ZzZrzBoL3pUvGS4P4AEzUsK0+lwdgAAwAwkRqIIYFUKTrJVy9TKwLUhbp9YbjVUVebVpyAKwYd0pABsGB9chSDqNJt0AGZXRyuTy8Hy5XIFaTyWH1V5NbBtczWRbBq5Y4MAGJ2kXinNgADi1oAEmNKkpFeSVKh5i1JtMOoM7Em9BTrrtu5TcB2wF2lboVX2G8qVUOqnzRyJw5OB2GlHXoOgWioYjM50l2UlZxk+EIRKJ2SfhGJdxkMqQYP46SR4agoFIb7eMo8oFDGP5yKWbofp+GSDIyMCoOUXhkLoKisowMCeFYEB9mBEoEFAVQSGyjxZBgBwdCBfIAPJxDIsEsuUiGaCQqFgHqmG6Nhui4XA+FgIRt6Bpxd7dueqxTv4TbzEeIE-kiNHQAEXgSPxuhVnYACyjTRvwEnIdw8lKc05S6KI8QQKw-ayUxOEyHo+hMAAfEKPGmEQRCkBAjliGWAAadHIrsjymPkUz2Y5znkNaACasHnmRelwMQED8AFTkubZc6fvpRCRP4ww-mE7IOC4nGVBk3Fzt+v7sjJogACSxBSXL1LAqCLtU6B0BhklJRkrIuYwZVvpVqDRs1tCtch8UyEl660CYujsCo5DMJYOg2LYaRzvpKisE1-VoKgFV5Ck20VaIMg6BUSgfEoYAfASQA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_g_association.Rd b/man/tm_g_association.Rd index 2509e026b..347744189 100644 --- a/man/tm_g_association.Rd +++ b/man/tm_g_association.Rd @@ -176,13 +176,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlQDCAPIATHG6-QMVpuqkHaLD0PCi7ABitNTkjOy0og4upVpokRyjpZsYJpMdpe0StATc7ACMADJyL129g8BnGtMAusPU+2ohw+XymjFEP1KUHEBHyLEmMi6AF8ukp9sMVHl2OMUroALz+DK4cZ8IQiGYE0nCMTY7qVXSkGCJCSJaGiIgEWiBKwQWn0+nVEz4wlBRJhUjMDSJUSoOAEPn8+kpOZ6AkKMCjdXEumK3SiOAiDTC-WG0jS2Xy8a6yoA+gG4XqgDKBrlpF0e0YXPoIkQWqt1thRBuYmFHq9IkSgeDCxSwGA6s1YB+kN0lrAAAUAWQtbp1XZWLKc3nqoF4NmwC9tdb6SbXXB+A6M1nSH6ddaTLRQvXhYsAIKPR2uNv8t6KuRVxUeikiqBi0ISybmuUK3XK2Cq3Mawat6u1o0EvdmmXL-26232tVgZ2m90scNiX14U+KqMEEMEsNQb1wSP5INvmMMjjBNtyTFM00zKBy1KPMCzgIswDsEtGQoFsK3HZ9+UPbtLyQuBS1Qndq10GBhE0SIN22ZwJ2rDsuwbAk+wHIdq1HEd-VHLouloIUNlUSVNB0GxbHKOlREKCBWF7dB2H2AASeooXQOT9UYHROiUJElDAJEfiAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYGkJGkoKJREQCLQwlYIIjkciGiYYZk0tFSMwNGlRKg4ARiSTkZkHnpgQowFNRtywUjWbpRHARBoYSKxccGUyWUK6tQoPRRTDuQFRUzSLotCx8fQRIh+X95boCCUlgQxDCdYw9SITubaJbNsaTSCoMBgNzedyXi8BW7kcy1c4ABr83TcrCDLyuPCRsBeADyjgAcg4AJoR71YACy2bAAQcgzsgwAjAWi9HSwAmAt+Ox2ABifPj3IAQrmsABpLB1sD9QNyANuyWauD8VVgaOxo2C+UmWhRCcwpuDUYBVzzkmD1nD111G3Q4GU6m06WM4Pbtm5DlTn14A-Isfi4Evi+yp8kxXK6hT9VStqupKlChqPteJJmhaVrAjadpwA60EuhBrKZJ63ojK2fojoGwaFmGBYznGVTcsmaaZgWgx5pWxalhWbaFrRgz9iRYANs2rasZ2PZ9tyu4mvuKF1O+K5cmA3G9ixX7IjARy0HEnL2E4zg4QuS6iboa4bluAlPvxui7v0-S0OS7AqOQ57aHANi2DUSKiGUECsIM6DsGgqAACQtFU7keSKjA6H0sxKGAMwvEAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_g_bivariate.Rd b/man/tm_g_bivariate.Rd index ad90d451b..c8ad47e15 100644 --- a/man/tm_g_bivariate.Rd +++ b/man/tm_g_bivariate.Rd @@ -244,13 +244,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlQDCAPIATHH+GRgmzPDs-QNdAL5dSmiowyp57BUjsQC8m1C4G3xCIqK6O6QwiRKJ9NostIFw692VuqGnu4lhpMwaiaKocAITxeLxS0Hg7wUYGmUP2zxBojgIg070RyNIfwBQI2IMq1Cg9CRkLAAGUkYDSLotHcCSJELCcbiCPkiLQCGJ3tTGPd6CJEszWezRMUMsBgFCYWAALpSuRw3EvNEUuD8YnECwM+G4ky0UIq94AMQAggAZEmuLWVLoguWM1jvFKfULfdQY-6A4G4sGwPQ7CWDTUKpUonbBt1Yz0K-GEvx+0nklFcnl0wMK3QCtkcnZJ2lwfkszPClJi-0DKEy22WxUJ8iquOCVBBADWcFTCpgwk0kV9umNZuc8rTOr1dd7pvNjKtjMrIMYRGyiRM6jglJ2jq+P3DHsnu3BPdLber6NRNcx26reIJRLjZOPOd5cHpeB3lQzQs5NIf+cFYhFQRL0IBtKsqDkGNb6nGdisACh4gsOEFjv2O7Wi8M4vG0i7LquHwbq6Z7YlW3oQnGkqgUeFInui+GRri0bXroUK3hR94ps+F7pgW77Zp+fJvr+xbioBZbAWhYHoghUJ2NUgTwGQsEvPBo59hOVYoVOzxdF0tAmLo7AqOQm7aI8ci2OUzyiIUECsEa6DsEsAAk9SlA5iKMDonRKLMShgLMUpAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgbpSDA0hI0vRtCxaGE4L8BnVdFEYZk0tFSMwNGlRKg4ARMdjsZkHnpgQowFNRoywVjqaI4CINDDOdzjmSKVTqdjqFB6FyYYyAlyKaRdFpUeKRIhWX8RboCCUlgQxDDFYw0fQRCdtbRdU9csBgIzmYyXi85GyNXU+XK4PwpUyAOKuPDqkUmWhRD0wgBig1GAVc7Ox-WpToDrDxuQJUSJ6gF5MpAbqtNg9N0tpGLP9sddsp5wLdJMFOfLovFkoZYBl-IVSuNcFVZZdmrNFv1nZNWp1Yi24WtxemYAdiYbFf5oZb0YAGmqF7oYEdaHFCxGo85nS6gyHPcCD9Hc7p43Hj3VGEQCmkDrr5cD8YTiVmhdf8-AvTtXsRRrd9dFA0ls2FDUxQlagvTbOUO0NZVuw3PtR3NPVgQNI0RwHcdMinJkS3tR17xAytyHPIsmSwABZdCT2DZddEvGMNVvOp52pboX3UOAwM-dNv0g38G3-Qtp1LCjFyQ6sqLE+s+1g5taMQnlcNQntZOxTDBxw4c4FNMdLUnG0SJnOddLkjRWMZLwAHlHAAOQcABNJiNVPVj2OvLibz+fp+loExdHYFRyG-bQMTkWwaixUQyggVhBnQdg0FQAASFoqkyrLOUYHQ+lmJQwBmF4gA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 4bac76283..dfbc4292f 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -166,13 +166,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6B6BFR3rHxSSkuGVk53nkBRCbkoqRF0aUJyQ6VupnZnrVwfmAAsgCCAMrjrSVxHRVpPdX9PoP+TEREMNMxs+VdaUoAxLpSEGrUuvxQpFC6cAAesKgiSlc3BsZc1AD6b1A2r2utyMugA7rRSAALFTsP6REBKXS6HyhD7IxihJQAX0UECUaFQaJUEL8ECRf3KcMRuj4QhEonKdGapKRSNIMG+El+oVIGPogk01mprMuPO+WhYlKB3wevPUpG+olQcAILJFrL+0Hg5X8KNEEWF6tEcBEGnKxtNCqVKvYEoxUHoIm+BEhRFoBDEQz1-jkkX8AAVYtwMAAZCgSKE+w1I3Ei2O6XG42gmXTsFTkZiWHQ2WwIsm6UTQiCsUbodgEgAk3kileNjB0jFxWKUYCxAF0gA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6B6BFR3rHxSSkuGVk53nkBRCbkoqRF0aUJyQ6VupnZnrVwfmAAsgCCAMrjrSVxHRVpPdX9PoP+TEREMNMxs+VdaUoAxLoAwgAiAJLjJ7r8UKRQunAAHrCoIkp3DwbGXNQA+l8oDZPvdHkZdAB3WikAAWKnYQMiICUul0ozO4wAMj9shjsUoAL6KCAAKyIKn+AGs4KxRIiwbYIfw4CYoMJSP8CPxQgR-uTKTS6cBoPB6UC5ABdJRKLQsUQARlxBFhFIIYn+ojgIg0cH4fggaLljFoUHoIi5qto6vFYOAwH8+Kx-klksiBCGoywwyK-hOAHlHAA5BwATV9YHGzgAGv45HJcKjdFqdeR+OUg44sc6ICSlGhULiVDCDWigeUkUm+EIRKJytXhGJS2jdKQYP8JIDQqQTfRBJprEmW7du-9jRWwf8Xj31JzRKg4B6h8PbmDRXpko7Mc68MvhynF6RygeNJqF0vDSvhyq1WJysbTea4Jbb7aHvatwSwK73Z6AOKuHguj+AAQsMWAANJYAqcYJnuK4nmm5SgeBUEwbul5XmiMAcrQ7wbroABioxYlGiaYVhJi0M8erlMRpGuBRw4klecFMcmM4PGOLATlx07MKe86Ls2V5AuuyFgE6ETwWiVHUOQjDlHJClnsJMktsadbJJpCrkVhLY4fJeEiHsqTqSxK5sVeEiMEQgioNxinJECU7PDOgnniJK5ibABGfjuemUbQ8kyEpwUqUJF76Ua8r3vKunqdhuH4aZLjmfBFlohZJIkrQJi6OwKgKbO2iDPGugopeojwhArCjOg7AFgAJN4kTNVqjA6IwJKEkoYCEpKQA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_g_response.Rd b/man/tm_g_response.Rd index 478e393a2..4dd5e9d33 100644 --- a/man/tm_g_response.Rd +++ b/man/tm_g_response.Rd @@ -200,13 +200,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXVIhrqu-lCkULpwAB6wqCJKAUEGxlzUAPoxUDbRgcFGugDutKQAFirsKbi6IEq6uoxwAI6CtNXsPqKkxNREjIoQlTCtLKJxur0E-RWmHbrsWroqugTsCoSs1Iuli1qiq7qLsFuLUiyLcrbl3ZVDfYyiwMBaALp3g1DiJuqkHezD-Tf3d12VAF8lACuko0KhBio8gszildABefwZXBjPhCEQDRFo4RiGHnXSkGCJCSJaqiVAkURwPH43TUKD0OB+RGLLBiCkQKm6AAK7VImzwY3xZI5XMRKUSYVIzA0iXJcHmQtpKWg8AR2zAXyuqyV+KpIg06v1CtIctQCpptPO9MZzI1AGUmSbdFoWLQGSJEDqzlbKgR8kRaAQxOrXYx3fQRIl-YHg6JihkbostQKHqVFUsVngNQdGEc5Cifb7jRo4Px1YsCMtvb7zjBhJpInpEQAxACCABl7c5C7XKiZaKEy+r213XEX8f9aQXdbpQuqJVKZab5YqJ+cVbBmxqUzXi07DYiSyvzWu+3SGUyK2BHQbSC63R64F7Bev8TGgyHEWGI1GP3GEyCJNNUuVM7nTBYwA2PYUBgfNez7Y9hxZKCBQQ2t62oRsRBHTtu3Q30ByHctWzw8daynSclSnLouloExJhUchl20aljjKMZREKCBWDbdB2HBAASepSiEqlGB0TpgSUMAATuIA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokqUBiXQGEAIgEkAZS9dfihSKF04AA9YVBElUPCDYy5qAH1EqBsEsIijXQB3WlIACxV2TNxdECVdXUY4AEdBWgb2CDFSYmoiRkUIOoBBHwCAGWT64bGlAF9+gCsiFTSAazhWUQrc23z+OBMoYVI0gn5aUQI0xeW1jeBoeE3MuQBdN2h0CZVi9lqQ3N0AF5-uFcH8+EIRKIgboIcIxL8BnVdKQYGkJGkGqJUCRRHBEcjkdQoPQ4NQYQowFgxDiIHjdAAFHqkUSUsFIwlY2n04GZNLRUjMDRpbFwAgEwnIzIPPTAylTUZsv6S3R4kQaGFqsXHUXi5Uq3TE0nkuVgAJk7W6LQsWgkkSIJUcg0EEpLAhiGHWxi2+giE6u2jup65YDAeUjRVgF4vKp6sAAIQAslgANJYABMbN0lK8AHlHAA5BwATUpcjk7INyK1Gjg-ApCeTaczeH1KpgR1ocVlugAYoNRgFnJWq6ZaFE6zD+4PXE7Cf0VRW27oojC+QKhTrUGKJSrpbAe+Hpq259WLRrgTWtzvl4SjWSG+b1aQrTa7XAHSfR7oXW6PcCvR9P1f0DBFMlDI9I2jWNfjNZwAA0s0pLBBi8VwwHLEcqyvSdTRQtDHW-DtqE0bspwHIcsINExx1wvsKNnKsF0lZi6mY-p+loExdHYFRyE3bR8XLao-lEMoIFYQZ0HYNBUAAEhaKpZLkvFGB0PpZiUMAZheIA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_g_scatterplot.Rd b/man/tm_g_scatterplot.Rd index 9f03f48db..43439b489 100644 --- a/man/tm_g_scatterplot.Rd +++ b/man/tm_g_scatterplot.Rd @@ -296,13 +296,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6BzgAepMwRUd6x8UkpLhlZOd55hETURIKMqLQEANYyZdGVCckOtUoAxLpSEGrUuvxQpFC6cIWwqCJK84sGxlzUAPpbUDabC0tGugDutKQAFirsR5EgSrrZno1w7NOipMStjEUEDeAGEAPIAJh2unBEKUAF8gUo0KhoSobn5gXMztUnq9dHwhCJRNVCcIxJi3m9SDB9hJ9mEFuQOq1SJSqW9qFB6HBZsl-ABlAhMmTrIikGG3IhdMQRfEcwq4s77FYldSkBmoOAEdkct5HaDwar+WFyrF63SiXnaiXJK0iDSa7W6i26Lk8vm6QXWjS6LQsWjckSIM2uqkEKUyknJf2MQP0ET7CPSggUo7AYAmyH+AC6OciOv8xAsZX8glQi16-jkclw8td9ptcH4xuaJbw9YtMGEmnWemSADEAIIAGQFzjr5tdJlohWb1WHY9cU45QIttc7uiG2MWKuKzEdoi1hZXVINsH7XrApo7p7ejd9dp9GqPzs3HPdvNbAuffoDQbgENbzDN5kyjapY3jRMwNTURHjODMszhMA8wLPw23CPAr3LSs4GrDc7ypB9yBbfkwBwqAq2AkDu2oXsRAXUdx0nEDTFnedByY5cwzXPUCItf4iEYfZ6G3I49zVQ9jxdDlzyNMibxYhtfyfB0X2k98qU-T1vTUv84wAoClLDGCxAg-8EzgJNI1gmTXXTTNr2zFD800jlCzAAAFLkyFLMA7FYLU-LsdwFngXysKLEhMMiMsK0ovCwF4njjOUtSON0AA5RwRxHVKux7Wg+0Ypd8r1Gc51I3RF3HTTkqpfi9VEWgAC8rNEpVd1VA91LfQi5MvJDQzSm1qmIp0T1Y7Tv1-SDDOGkybLMmMLOgpa4IcoaXLQqL21i8j4qomsyo5YiMri3CFtdWj6MvGqJzctjKpK2rCPqt5Go5RgiEufYTHUWJOqgCSeomuz9TOQ1Bqc5CTstFT4bUsHHumsifz0ubLKMx7TOjfSoKs3H4MWRCYdzfNdA87yoAi-aAqCyL-NCmkKFIfC4fvZ8Muy3KOYJQris40rHoqjL7rqzdPvDFo-oB20d2B7r1WR-rIYvVtFM04ixufFWpu5L80dm1bAKugT1vMgzLOslM0wQxyb1Qyn0Op2mr3pxK6eZ8K2aSqWLTOqqebyx6bqKhiheYkX2Kq8W3sl+teKBIFaBMXR2BUZl1W0L4a10F4sVEe4IFYId0HYFEABJvEiKurUYHRAQRJQwHhHMgA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBISqDC0ogT+uLpetHCk1Ky6ALz2Ts62AGTpuu7Rvv6BzgAepMwRUd6x8UkpLhlZOd55hETURIKMqLQEANYyZdGVCckOtUoAxLoAwgAiAJIAypO6-FCkULpwhbCoIkorawbGXNQA+vtQNnur60a6AO60pAAWKuznkSBKutmejXDsEDEpGIrUYigg3wAgtN5gAZQ7ZaFwpQAX3BACsiCoTr1WKI3tdbLd+HATFBhKQTgR+KECCdMdjcaJgNB4PjznIALpKJRoVAIlSPPwQ5bXarvL66PhCESiarS4RiYXfb6kGAnCQnMKrcgdVqkZUq77UKD0ODUar+eYEHUyHZEUhTJ5YghiCKSo2FcXXE6bErqSmiVBwAiGo3fc6svTJfxI2HukXh3Sic0hx3JFMiDRa4Ohj1J3Qms0WmNgeapjS6LQsWimkSIBMFlUEZ1dMTVauMWv0ERU1uu9nXYDAWMw+NgTmcyJ5sCQgDirjwun8ACEALJYADSWAAjGVVxvtwAmfxyOS4fNJzNpuD8S2zheNptSim0HbR3QAMUhsPmzgviYFiYtCFLe1Tfr+riAUa4JJuel66EMoprL6xTMNmQYhmG4aRrAH6jsieAId816VhmFaBrm2FJkW5r3uWWaOp23b1k+TYti67bJMxdZwH2nGDmsw4EeOk7Tn4D6LpEB5bru+5gOusknmAZ4Ac+yYUWBpaKdue5EdB4YwK+77gT+f5qc+wGgXeyQQX+xG6LB4bwQZIJEIwJz0Eh5yof6GFUQ5uHwPecZseGpHphpjE5lhDnGqadGlgxaZVjWvENvp6kcW2crcWlPZ8dlA7UQW5zCbOY7+GJcXNhJ85ScuCmHnJS4yce8lYJCkwNf4WDOHOswAPIAHJ6U5TYuepEVabow2OLCsIWU2RnUJoJm2WZ-41VZM12VBE0IZN4W0AAXnxXneihfroZRsUGRG1xRiFlWZQWEXVBFMV5vdKq0SWjXJZWPEFRlS0FkVXGpV2vH8TlBJCSOFWEWJugzvV8k6S1qk1dNNmNejr3LcZIimZBYNJjteN7Q540qkdRqMEQdwnGSrqRT510Bl9JUPWsT2lqFhPhRRH0UdzNV-fRIvA6xQtJhDuVQyxhX9kqZWI4LKMzpjynSWAnXdR1-VDaNp7029ml43NC3k4ZxMfntttGpTpP2T9tPfOb3wgiz6ixJdUC+Td4s-UF+FI+OTtRSl5HRZh33qZLSXS-lstR97quKzLKsCfDUDlZrU6oxJOsdV1PX68bI1jV7wuMTN1uLTVK1rSTG1k9tIG7ZtNOHfmTnguCtAmLo7AqLqAbaP8Z66J8IqiC8ECsJC6DsHyAAk3iRBvKaMDoYKokoYAopyQA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_g_scatterplotmatrix.Rd b/man/tm_g_scatterplotmatrix.Rd index 7faa664d1..7a9cb9c0e 100644 --- a/man/tm_g_scatterplotmatrix.Rd +++ b/man/tm_g_scatterplotmatrix.Rd @@ -204,13 +204,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CmlCkmgRw-ri6XrRwpNSsugC89k7OihAAxLpSEGrUuvyBULpwAB6wqCJK+aSFRrpc1AD6VVA2lQUGxgDutKQAFirszeEgSrq6xOakjFGiHXkFGCbM8H4QY2O0-AnjfmAAIq54uv4AYlhhx2AAknYX-s4AyndgAAq3R-4A4ucfYAByABlngAhQ7hfwAxzPACC7zkuFG6wkRB0jAg8DI2xM6lIREYq3W6wI7AATOEyboKQBGcm03Q0+nhBkk+GIwnUKD0ODUWaJYn+ACyJBYBF6rGeWDgqEE9DoBH8qUJrLW6w5EAkgigUga2JgtFiWJxeIJhJ2DIAzOFLbprdbqUyrUzlabdByuTztvywJ8ZDAoMp5b8ABLckQBiVEP0WUJgRXrZ3rVBEaUczQkT3sAAc1oAbAB2cI5gAM4QALAX6SX6QyqRWqQyixgc+EAJwJsYsOCFPnsc0AVgrfb7FqLDL7Rb7rep5oppZH5Kb4Wz7cy-FQGfNGFLC4rJIwNa34Ub1sbFMbFcbk90jYbW5X-Dg9FIGb3zIwdsPlMXX4-25-C7-PdfzjONRG4MQ5maRZljgE0Ni2RIqUQccERVMYJjINgGk2bYwJgcpYLZIldgOZ4zmeG5nkeZ43meb5nkBEEwUuSEYThVCXVEWgAC89ESFCiLGdxynUPikhcIiV1YLtGFwvFSHYPCCNJUci0QEkiw08IUN0YSORCbYHBcOQVx0CBBDEpSRHYL1RD9ahqGeeB+FoQQYGeDlGCkZ4SDobIFW0qs9NEwzkhXAh-RCBy4AQ3QrNg4kjOccITmhAEHhSQLwmCgzEiSlcvH9TRSDiRI0TxGB2B0qkiyrDTwqIURSF5XSIAqqqq0zOqixXVBGCIEwem2crGEqnStMrEClAAX1SAArIgVAaABrOBWFEQYClsWoFqW1b1pNXaIBWtbdgwqYZmec7pjEZ5NgCxEjpOjh-DAkRRGeN7bt+e7Yw43Qnv2s6iEmG6Pt+L7wfCL1fu2fxrtYbD+AVVJUiUNB11qFQehNZptiGRE+CEd7tiJ4QxDguoYAaCQGlECKghkcoiFIP0LuKSmxjdbk4bAB4GfIRhmefNnpmKMJBN0LQWFoTkScSOgms59ZmgaEophxOnUDgfk0JdeZqmgeBeeuy68ElwlRG5HXn0SK2RA0LWdeVl1udyRJ-Aea2NClmW5bERAJb1-Xxl6RaQha6Xpn9hpRXDinmmAYB4ZBzCzYAXXTlcQ-tm2YozfxOygZ4JDXZ4HyfB7g-1mBhE0AjQpcf6Q7GPEH3cWKkublvBuKfPElS9LXGrpULd0bOVYKNXig1x3RG13WW4N-1YDE17wKhsexkG6hBaxfVBadxel9dTkeY9vnvefKPZdlOBA-NkfTSjlqU9BxHfu7kO49oCPtml6gFlY5h1-gnAoSd17vX8JncEhBU5TA-sjP6W91i5w0P3HY-hSK-HIr8SivxqK-For8eivxGK-FBM8VivxYRVxProWuu9aANzyskFBE9LZX1wlfI+LtTRu15l7B218-Z31EA-L++sf5-0SDfGO0iwHVAgWASG0D07Q12IVMgPRxS-GIE1KGlw+oDR6CjSRnEr4YK9Fo4qujYH6Oas8Yxg1SB0JPow+uIhG7JRQa3Rg7cMFd18aYWgfdYqDwyuwsecZR56ymhAVItATC6HYCoQWOJtCwRMroEYKpRD9AgKwaE6B2AYwACTeHCOUq2jBUSpGmkoMA0105AA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CmlCkmgRw-ri6XrRwpNSsugC89k7OihAAxLoAwgAiAJIAypm6-IFQunAAHrCoIkolpGVGulzUAPr1UDZ1pQbGAO60pAAWKuwd4SBKuroAgtn5ADK9uoxzi1Oz2Vj5y6tb+UoAvqkAVkQqrQDWcKyiY6W2TfxwJlDCpK0E-LSiBK1nF2ut2A0Hgdw6cgAukolGhUMsVIM-BBph0EsVSrgNnwhCJROiccIxMjptNSDBWhJWr9AuRGDUiOTAoxaBUSaTptQoPQ4NR0f58gRaTIGaRdDBmaywhsOVoWLRuXj0XRRKR2RzUaVWpVSMwNNTUHACOqNZqGqC9Il-GsFtKUabSaJeUaxYknSJ9aJDcaZQ7OdzefywPlnRpdHKWYqxIg7X6OQQhucQvjEhGFfQRJ9E7Rk-cGsBgNb5rawJDIXIsfa47p3S64Px0T6wDMAOKuPC6fxYGaZdvhAXOAAa-grvr9MHetBqlqSLkr1emREYz3cDcSDjnY4dJlZ9fRADEZgt8q4qw7Un7R2eOR1tRVdeoPl6jSbTR0LUG5ttY3Gd9Q6eif50gaL5bqaXI8nyVrBqGYoUPwqDnGQogxngYEahGKa6E2AAKMzdgAsjkYSds2ABqBS5HYI7zguCZJmI6JytQghwFmDHgqUBZFt+paQuEuH4TMRHZCR1oUfkVE0dhfhgHhhFieRlHUWAchXguNawXu0G5AAcmRzh2LoxjOLp2S6AA8vuuh6dkjiZHYuQWbpP7VhO-5TiI6Ibqe1bqXGtZhm6sEgT614OhBgbQSGHpimmUYoa5cb0TmjGpvKUbsalnH5oWzb7P4Zb+dWgXkGuMnWm2ikzGRR7VdkACaNHoRy7maNO3nJLR1ZLiu2mzs43W-ru5WHsevlxhe55blN0xTakqS0CYujsCodKPtocA2LYkz2qIIwQKwMzoOwcIACTeOE51OowOiMKkhxKGAhyQkAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index c05408180..d5b1e919b 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -132,13 +132,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBKMtPzOAB6kzP64ul60cKTUrLoAvPZOzrYAZJm67rG+-ozUUBASUTHe8YkpaS6KEADEulIQatS6cKGwqCK6-FCkUEr9gwbGXNQA+iNQNsMDUGO6AO60pAAWKuwz0SBKurme3r6toqTE1ESM9fu6UPz8k9CiS2YWmtahtnsQBwehwFE3RE7FEnkm3BIEnYX2iJkuV3YIlKGxhtgAVLlzLQTOwAIzRDAABgArIS8QB2OTUgC6SwAcgBBW7-W4AXyUtx8tBeRl03NEtxg5xYvOMwoIos5v35QVEwDpfOK6ES7AF0Xuj2e9QOEtFCqWyp6HD1jFEGoeTygoh1ulN8uA-gIrGo-hpiuM1owJnUpER9uAjsILrdNNtAaDUhYoaWXp9Gn9IrNgf8UcYofqbJu0HQSxUaz8MpmNR2QoEwjENT4QhEokLf10pBgkxgPNEKgk0wWcxl9XqON0atUzEsOhs31uok2EFYjPQ7DQqAAJN4Negl2DGDprkoORAwGyaUA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsBKMtPzOAB6kzP64ul60cKTUrLoAvPZOzrYAZJm67rG+-ozUUBASUTHe8YkpaS6KEADEugDCACIAkgDKzbpwobCoIrr8UKRQSiNjBsZc1AD6k1A2E6NQ07oA7rSkABYq7IvRIEq6uZ7evhBipMTURIz1pwCCrZ0AMuuML+8nui9YnU+-06SgAvvUAFZEFRzADWcFYogOq1sRmGcBMUGEpDmBH4tFEBDmUJh8MRwGg8CRizkAF0lEo0Kh1iptn4IKdFjVDr8+EIRKIanzhGJ2adTqQYHMYATRCoJAtVssObp6vVaCZdOwVORmJYdDZbMcVaI9hBWE90OwmQASbzRW2iGQ6B5gpRgUG0oA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index 895dd5168..f0244879d 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -173,13 +173,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokrcQAxLqkQ11XfxQpFC6cAAesKgiSoHBBsZc1AD6sVA2MUEhRroA7rSkABYq7Km4uiBKuroAwgDyAEzxNQ2VzfXAwApgqIy0MCysSQDWcKxdALrjTaJwAI5JIhDsEIxEOex19XKKEAC+OwBWRCrDo6IlmbbZRycjrOc3EKccXZtdZa8teLpdPX0Dzy623cWhYoiaBAKxwIYiSMxEGjg-HYoN6UHoIiSkOhYguwQ6n3qE3GZQI7C6AAVqFAyO8fmA7KxUHA6V07Iw4EF4LSwNsdko0Kgmip8uSIFVUroALwBTK4Vp8IQicEyxXCXGtKqkGBJIiCUh0GTnTVVXR6g20GRJVHS3R0USkMWm52y4JJcKkZgaOHMskml2ummwPQywnvf0u+FwDS2qPe0S+p0Bl3U+hwfyhsAAZXT0dIulRtHRIkQ4fFyed2NoMJVBZYRYxcCxUOruNSBLAbzAk1J5MIJAIrLAglQwRGQLk8vLFaqcfI-FtXRHY5ZeAjAZgwk0URDugAYgBBAAyWecU5nppMtDCSNth5PrmnyZ2FZfLsnEYIQTgEiIvS-yQ2jK9qOuugbumEnrqKQPrRkmFapNA8CLp2XznjOV7UOQjC2ph2GwX6T4VqitYkehF5VjWtqgtQghNpRbaZB2XY9nWjCiAAJHOSIfkRybcQuMo0XRzY4uc7adKhRLdiSbGcQJvEXlUm5YbQO62g4LhgVUb4Brppr6W+Ow7LQJi6OwKjYdB2hwDYtgVOWohFBArAHug7CChxgi0GUnkzIwOiMDsuxKGAuzjEAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAokrcQAxLoDCAEQCSAMreuvxQpFC6cAAesKgiSmERBsZc1AD6SVA2ieGRRroA7rSkABYq7Fm4uiBKuroAgr6BADIpuoxNrUoAvooQAFZEKukA1nCsopV5tgX8cCZQwqTpBPy0ogTpQyPjk8DQ8FNZcgC67osa6VosoulQ-KLU7Ydi7ABitNTkjOwbDi5qqI0PEOFlgMAFGAui0oadTtUNhhLqQiIw5BilDdGKJ2gRSsMCGJ0qI4CINHB+OxsbQoPQRKsCbQicc8hCoTC4QjTOoVti7g8npiIO4lCD2ioSuw6qE8roALyyiK4GV8IQiXGKtXCN4y+qkGDpIiCUh0GRTPX1XTG020GTXFgK3R0USkaUQK2epVQdIxUjMK6iVBwAjur1erKvJ0c5qwvCW8Ok8mkJ1JkMrIMhsPhr3UOlk6NgQJk9O6Gl0kSIKEqj05z34wliJ3l+lwRmN1kRdnQ2Nc6qhjkAcVceF0UIAQgBZLAAaSwAEYoRia3XPWmKfxCw1h9WEzmYMtaPE9Ir3g0WoFnCvV-UTLRopSnWeL65a3X+u+93Jr-XwnAJGizLcA6jBOi6bp7vUWS+tE-q8iSwYDm+OaRrAJ5jj23Txsh4Z3t8MhOnhPwIVmkFevyza3D+q4NsyTaKjc1CCG2tEstMXaQphcbwtU-IACTruQ-DfmRa4lhulFMSxTJseCnGcmAPFlrcAniUJIk4fuh7Hk6AKvjeH45oZnrGbohn9P0tAmLofyqAGmg6DYti1LWojlBArANOg7Agnxgi0NUvmkowOjor0ShgD0pxAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_t_crosstable.Rd b/man/tm_t_crosstable.Rd index f4e4953e9..23ef6d6e2 100644 --- a/man/tm_t_crosstable.Rd +++ b/man/tm_t_crosstable.Rd @@ -175,13 +175,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsIykUPQiov64ul60cKTUrLoAvPZOzooQAMS6UhBq1Lr8UEG6cAAesKgiSgVFRrpc1AD61VA2VYVQBsYA7rSkABYq7M0RIEq6ujCkBCyinRNTM2OmRIy67Fq6KroEfoSs1OG6-lpheEcoMIf+Uiz+crajEOPjk9OMosDAWgC633NQ4hM6lIK3Yrxmnx+3zS4wAvktwe9Pv5UIxaDAWKwGgBrOCsfy-OaiTwNEQQdgQRhELpghbve5KWFpABWRBUOLxoiG7VstVZ7NxrC5-IgHI4-kRpwiErpUvOqPRmLFdzSSjQqDmKl6fie+XaiT1QVwCIEwjEBr4QlCOuedRgDVIDQIVNEoiCITgNttumowTgeSS-gAwi7ZnZgpU8EtbSUDc0GqVSMwNA1RKg4Dto97mtB4AaZW8pVnbcSRBoDaWM460xmvd7nr76P782AAMr+qu6LQsWgRuCIcLF70EPpsgjmpLdtF9p2j2jjrnNZFgSUE74RTN7A5nY5y-ywK5gG6MFXG3X18aVjRwfgGzcEfaH493M8X54wYSaCp6JIOFyvt9dBWfgZBvA0-2cAC3xMWgSjApIADEAEEABlW1cc9vRhLCoOeeIknjRNk2rdNM0w20c1gH9zlXKNyOeK9SArDsUxrMjAJ9P0A3OdsyyYqdew9Ac6I4kcxwnLsexnMT5zEbkgmXWjfg3XYH23aUwBOQ8Dx3I84FuMB7lw+tGPg84tJEwCP2oL8RANZC0MgodbRguDb0Q1D0Oc3RsNtXyfKWNI0loEw1hUchiO0T17l0R5LwGCBWCQ9B2HVAASbwInS4lGB0Rg0nhCAwFhb4gA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsIykUPQiov64ul60cKTUrLoAvPZOzooQAMS6AMIAIgCSAMpZuvxQQbpwAB6wqCJKpeVGulzUAPoNUDb1ZVAGxgDutKQAFirsHREgSrq6AII5BQAyfbqM80tKAL5pAFZEKq0A1nCsouM9tk38cCZQwqStBPy0ogStewfHp8DQ8GcdcgAukolGhUCsVEM-BAZh1EiUerhpro+EJQvDUcIxNCZjNSDBWg8CIwiKJREEQnAcbiZtRgnBqPD-FkSWT7ME6nhkTTKvCOq0qqRmBpWqJUHACNSabCer89El-OtFuFudLRAyJaR4eqRCKxRKpdLafTGQqwAUNRpdFoWLQOXBECqYUbcQRhvsCGJ4TbGHbKY93bRPf8esBgIqFsqwIDARFRIJ6OqtUkzBZNNYAbops6XbjaPxeU0AIQ29Bxc5BCIqYYyIaiCLUIgSIPcdgARjkEUl-hyZTg4V0-gACgB5Ap5AAaGgHw7Hk+opH8cjSuZp7lIgkYEHYcpDQTkwHzlUBK9X2yROZdOs1cH4TLAWRHjgAcg4AJpO1co+60Wry5IuBeX5EIw1zuHeSQOIBqpGiYtCVLe8IAGKzIsBSuJeNKnlhQHSvEST8oKwoPPq3aYbiHRyveSqflelrJro156uKZFfnS9AMveFq6lqPp+iIjpcuRNJuh6XpJHx9oBmJe5QGGEYbNGsaMQmSbwqmlgZhcWYwS6R4rKWtQcBMugvBgtwaCBDZNi21DtsuulGuum7bruFZQAeR4no5uLnj5MxMeQEGDuazgTrRuYwD+f7Iah6G4bmcEIcFKFoRhubYbimWnmkaS0CYujsCo5DEdoVLLjpzqiKMECsLM6DsGCAAk3gRM16qMDojBpJsShgJsgJAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } diff --git a/man/tm_variable_browser.Rd b/man/tm_variable_browser.Rd index 752c4c83d..b36911ed4 100644 --- a/man/tm_variable_browser.Rd +++ b/man/tm_variable_browser.Rd @@ -104,13 +104,13 @@ if (interactive()) { \describe{ \item{example-1}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsKKoLADWdBBw-ri6XrRwpNSsugC89k7OtgBkGbruMb7+ABakMNQA7rT8UqSikdHecQnJqS6Z2bne+WAAVqIkdOS1MQ2JKQ4tSgDEulLhsrr8UKRQunAAHrCoIkoLSwbGXNQA+jtQNtuLy0a65aQFKuwnUSBKuro+tKJ7b4wfL7owpAILE+VwBQMYNQgr1KRHgUKuMLhfxMUFotzM1C+KLRBQxfwAwgB5ABMXyJxKUAF9FBAlGhUF8VGi-FD5hcmo8-nwhCJPilucIxCzXq9ioctCxaFB6CJDkwiKVRDJhSLXtRpXBMSl-AA1SXSkS6eWKmT+P6vGkWpQ02gmXTsFTkZiWHQ2WzPVmiO4QVgAQXQ7HpABJvFFg0rGDpGDTKUowJSALpAA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } \item{example-2}{ \href{https://shinylive.io/r/app/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKcqajGIgEwCu1OAGcMAcwpxm1AJQAdCLTIyoBUrQBucAAQAeALS6AZoIgbaJdnN0AVLAFUAoksZwAjoNrv2CsKKoLADWdBBw-ri6XrRwpNSsugC89k7OtgBkGbruMb7+ABakMNQA7rT8UqSikdHecQnJqS6Z2bne+WAAVqIkdOS1MQ2JKQ4tSgDEugDCACIAkgDK07pwAB6wqCK6-FCkUEp0TCwcgSFhcIoQu-sGxlzUAPo3UDZKL3e65aQFKuwvURASl0ugAgrNFgAZT6McFQ4Fg2Z2OzOGHg5GuCAAXyuXSIKkewTgrFE-z2UFsRh2cBMUGEpEeBH4tFEBEeeIJRJJwGg8FJLzkAF0lEo0KhPipaKQ-BAQR8UgCEXwhCJRE1lcIxDKQSDio8tCxaFB6CJHkwiKVRDJtTqQdRjXBqE1-AA1Q3G7bmy0yfwIkFXf1KK60Ey6dgqcjMSw6Gy2IGy3SiX4QVig9DsMUAEm8USzVsYOkYVyxSjAWMFQA}{Open in Shinylive} - \if{html}{\out{}} - \if{html}{\out{}} + \if{html}{\out{}} + \if{html}{\out{}} } } } From 0b3b10bd25c04abc2afffce7dc6e13af26eedc33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:03:26 +0000 Subject: [PATCH 04/31] fix: corrects assertion --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 477bb7400..aee278d38 100644 --- a/R/utils.R +++ b/R/utils.R @@ -297,7 +297,7 @@ assert_single_selection <- function(x, srv_decorate_teal_data <- function(id, data, decorators, expr, expr_is_reactive = FALSE) { assert_reactive(data) checkmate::assert_list(decorators, "teal_transform_module") - checkmate::assert_factor(expr_is_reactive) + checkmate::assert_flag(expr_is_reactive) missing_expr <- missing(expr) if (!missing_expr && !expr_is_reactive) { From 8e262c3752e13bf2b5eb952a8e0e53e97f7a4733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:14:19 +0000 Subject: [PATCH 05/31] feat: tm_g_bivariate --- R/tm_g_bivariate.R | 90 ++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 390640dd6..faa6fcd82 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -276,7 +276,14 @@ tm_g_bivariate <- function(label = "Bivariate Plots", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) # End of assertions # Make UI args @@ -350,7 +357,7 @@ ui_g_bivariate <- function(id, ...) { justified = TRUE ) ), - ui_transform_teal_data(ns("decorate"), transformators = args$decorators), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), if (!is.null(args$row_facet) || !is.null(args$col_facet)) { tags$div( class = "data-extract-box", @@ -665,47 +672,46 @@ srv_g_bivariate <- function(id, teal.code::eval_code(merged$anl_q_r(), substitute(expr = plot <- cl, env = list(cl = cl))) }) - decorated_output_q <- srv_transform_teal_data("decorate", data = output_q, transformators = decorators) - - decorated_output_q_facets <- reactive({ - ANL <- merged$anl_q_r()[["ANL"]] - row_facet_name <- as.vector(merged$anl_input_r()$columns_source$row_facet) - col_facet_name <- as.vector(merged$anl_input_r()$columns_source$col_facet) - - # Add labels to facets - nulled_row_facet_name <- varname_w_label(row_facet_name, ANL) - nulled_col_facet_name <- varname_w_label(col_facet_name, ANL) - facetting <- (isTRUE(input$facetting) && (!is.null(row_facet_name) || !is.null(col_facet_name))) - without_facet <- (is.null(nulled_row_facet_name) && is.null(nulled_col_facet_name)) || !facetting - - print_call <- if (without_facet) { - quote(print(plot)) - } else { - substitute( - expr = { - # Add facetting labels - # optional: grid.newpage() # nolint: commented_code. - # Prefixed with teal.modules.general as its usage will appear in "Show R code" - plot <- teal.modules.general::add_facet_labels( - plot, - xfacet_label = nulled_col_facet_name, - yfacet_label = nulled_row_facet_name - ) - grid::grid.newpage() - grid::grid.draw(plot) - }, - env = list(nulled_col_facet_name = nulled_col_facet_name, nulled_row_facet_name = nulled_row_facet_name) - ) - } - decorated_output_q() %>% - teal.code::eval_code(print_call) - }) - + decorated_output_q_facets <- srv_decorate_teal_data( + "decorator", + data = output_q, + decorators = subset_decorators("plot", decorators), + expr = reactive({ + ANL <- merged$anl_q_r()[["ANL"]] + row_facet_name <- as.vector(merged$anl_input_r()$columns_source$row_facet) + col_facet_name <- as.vector(merged$anl_input_r()$columns_source$col_facet) + + # Add labels to facets + nulled_row_facet_name <- varname_w_label(row_facet_name, ANL) + nulled_col_facet_name <- varname_w_label(col_facet_name, ANL) + facetting <- (isTRUE(input$facetting) && (!is.null(row_facet_name) || !is.null(col_facet_name))) + without_facet <- (is.null(nulled_row_facet_name) && is.null(nulled_col_facet_name)) || !facetting + + print_call <- if (without_facet) { + quote(print(plot)) + } else { + substitute( + expr = { + # Add facetting labels + # optional: grid.newpage() # nolint: commented_code. + # Prefixed with teal.modules.general as its usage will appear in "Show R code" + plot <- teal.modules.general::add_facet_labels( + plot, + xfacet_label = nulled_col_facet_name, + yfacet_label = nulled_row_facet_name + ) + grid::grid.newpage() + grid::grid.draw(plot) + }, + env = list(nulled_col_facet_name = nulled_col_facet_name, nulled_row_facet_name = nulled_row_facet_name) + ) + } + print_call + }), + expr_is_reactive = TRUE + ) - plot_r <- reactive({ - req(output_q()) - decorated_output_q_facets()[["plot"]] - }) + plot_r <- reactive(req(decorated_output_q_facets())[["plot"]]) pws <- teal.widgets::plot_with_settings_srv( id = "myplot", From 929f45f36bcd14ca778452d229892a135139837f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:19:41 +0000 Subject: [PATCH 06/31] feat: tm_g_response --- R/tm_g_response.R | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/R/tm_g_response.R b/R/tm_g_response.R index 18f8d6d6d..e94580bb0 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -201,7 +201,14 @@ tm_g_response <- function(label = "Response Plot", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) # End of assertions # Make UI args @@ -285,7 +292,7 @@ ui_g_response <- function(id, ...) { selected = ifelse(args$freq, "frequency", "density"), justified = TRUE ), - ui_transform_teal_data(ns("decorator"), transformators = args$decorators), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -552,13 +559,14 @@ srv_g_response <- function(id, teal.code::eval_code(qenv, plot_call) }) - decorated_output_q <- srv_transform_teal_data(id = "decorator", data = output_q, transformators = decorators) + decorated_output_plot_q <- srv_decorate_teal_data( + id = "decorator", + data = output_q, + decorators = subset_decorators("plot", decorators), + expr = print(plot) + ) - decorated_output_plot_q <- reactive(within(decorated_output_q(), print(plot))) - plot_r <- reactive({ - req(output_q()) # Ensure original errors are displayed - decorated_output_plot_q()[["plot"]] - }) + plot_r <- reactive(req(decorated_output_plot_q())[["plot"]]) # Insert the plot into a plot_with_settings module from teal.widgets pws <- teal.widgets::plot_with_settings_srv( From ff7d3c2573b9e00b7b80c9f244fe043dc38d9dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:37:31 +0000 Subject: [PATCH 07/31] feat: tm_g_scatterplotmatrix --- R/tm_g_scatterplotmatrix.R | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 0c2a563e1..db356d2b6 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -202,7 +202,15 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) # End of assertions # Make UI args @@ -249,7 +257,7 @@ ui_g_scatterplotmatrix <- function(id, ...) { is_single_dataset = is_single_dataset_value ), tags$hr(), - ui_transform_teal_data(ns("decorator"), transformators = args$decorators), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -444,12 +452,14 @@ srv_g_scatterplotmatrix <- function(id, qenv }) - decorated_output_q_no_print <- srv_transform_teal_data(id = "decorator", data = output_q, transformators = decorators) - decorated_output_q <- reactive(within(decorated_output_q_no_print(), print(plot))) - plot_r <- reactive({ - req(output_q()) # Ensure original errors are displayed - decorated_output_q()[["plot"]] - }) + decorated_output_q <- srv_decorate_teal_data( + id = "decorator", + data = output_q, + decorators = subset_decorators("plot", decorators), + expr = print(plot) + ) + + plot_r <- reactive(req(decorated_output_q())[["plot"]]) # Insert the plot into a plot_with_settings module pws <- teal.widgets::plot_with_settings_srv( From 7a96181036177a8bda62315655a93c313f9495d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:50:39 +0000 Subject: [PATCH 08/31] feat: tm_g_crosstable --- R/tm_t_crosstable.R | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 549fde366..6199e5ad5 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -167,7 +167,15 @@ tm_t_crosstable <- function(label = "Cross Table", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_class(basic_table_args, classes = "basic_table_args") - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "table"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default", "table")) # End of assertions # Make UI args @@ -234,7 +242,7 @@ ui_t_crosstable <- function(id, x, y, show_percentage, show_total, pre_output, p checkboxInput(ns("show_total"), "Show total column", value = show_total) ) ), - ui_transform_teal_data(ns("decorate"), transformators = args$decorators) + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", args$decorators)) ), forms = tagList( teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") @@ -407,15 +415,18 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, ) }) - decorated_output_q_no_print <- srv_transform_teal_data("decorate", data = output_q, transformators = decorators) - decorated_output_q <- reactive(within(decorated_output_q_no_print(), expr = table)) + decorated_output_q <- srv_decorate_teal_data( + id = "decorator", + data = output_q, + decorators = subset_decorators("table", decorators), + expr = table + ) - output$title <- renderText(output_q()[["title"]]) + output$title <- renderText(req(decorated_output_q())[["title"]]) table_r <- reactive({ req(iv_r()$is_valid()) - req(output_q()) - decorated_output_q()[["table"]] + req(decorated_output_q())[["table"]] }) teal.widgets::table_with_settings_srv( From e7cb0f1638ac8f42c4c46f3cb58d698f86107b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 16:05:09 +0000 Subject: [PATCH 09/31] feat: tm_data_table --- R/tm_data_table.R | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 657d5bf6d..b4a49deae 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -131,7 +131,14 @@ tm_data_table <- function(label = "Data Table", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "table"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default", "table")) # End of assertions ans <- module( @@ -296,7 +303,7 @@ ui_data_table <- function(id, tagList( teal.widgets::get_dt_rows(ns("data_table"), ns("dt_rows")), fluidRow( - ui_transform_teal_data(ns("decorate"), transformators = decorators), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", decorators)), teal.widgets::optionalSelectInput( ns("variables"), "Select variables:", @@ -365,13 +372,15 @@ srv_data_table <- function(id, ) }) - decorated_data_table_data <- - srv_transform_teal_data("decorate", data = data_table_data, transformators = decorators) + decorated_data_table_data <- srv_decorate_teal_data( + id = "decorator", + data = data_table_data, + decorators = subset_decorators("table", decorators) + ) output$data_table <- DT::renderDataTable(server = server_rendering, { - req(data_table_data()) teal::validate_inputs(iv) - decorated_data_table_data()[["table"]] + req(decorated_data_table_data())[["table"]] }) }) } From b29e8d1738f65e4634e40267e672bd4bd9c31958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:44:33 +0000 Subject: [PATCH 10/31] fix: when only 1 ui_decorate, default is the only accepted name in decorator argument --- R/tm_a_pca.R | 8 ++++---- R/tm_data_table.R | 6 +++--- R/tm_g_bivariate.R | 6 +++--- R/tm_g_distribution.R | 11 ++++++++++- R/tm_g_response.R | 6 +++--- R/tm_g_scatterplot.R | 6 +++--- R/tm_g_scatterplotmatrix.R | 6 +++--- R/tm_t_crosstable.R | 8 ++++---- man/srv_decorate_teal_data.Rd | 4 ---- 9 files changed, 33 insertions(+), 28 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 1e26cd571..09af523fa 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -166,13 +166,13 @@ tm_a_pca <- function(label = "Principal Component Analysis", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { lapply(decorators, list) } else { list(default = decorators) } } - assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) + assert_decorators(decorators, null.ok = TRUE, names = c("default")) # End of assertions # Make UI args @@ -247,7 +247,7 @@ ui_a_pca <- function(id, ...) { choices = args$plot_choices, selected = args$plot_choices[1] ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)) + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)) ), teal.widgets::panel_item( title = "Pre-processing", @@ -985,7 +985,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl decorated_output_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("plot", decorators), + decorators = subset_decorators("default", decorators), expr = print(plot) ) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index b4a49deae..ccf229220 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -132,13 +132,13 @@ tm_data_table <- function(label = "Data Table", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "table"))) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { lapply(decorators, list) } else { list(default = decorators) } } - assert_decorators(decorators, null.ok = TRUE, names = c("default", "table")) + assert_decorators(decorators, null.ok = TRUE, names = c("default")) # End of assertions ans <- module( @@ -303,7 +303,7 @@ ui_data_table <- function(id, tagList( teal.widgets::get_dt_rows(ns("data_table"), ns("dt_rows")), fluidRow( - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", decorators)), teal.widgets::optionalSelectInput( ns("variables"), "Select variables:", diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index faa6fcd82..861b20f1f 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -277,13 +277,13 @@ tm_g_bivariate <- function(label = "Bivariate Plots", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { lapply(decorators, list) } else { list(default = decorators) } } - assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) + assert_decorators(decorators, null.ok = TRUE, names = c("default")) # End of assertions # Make UI args @@ -357,7 +357,7 @@ ui_g_bivariate <- function(id, ...) { justified = TRUE ) ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), if (!is.null(args$row_facet) || !is.null(args$col_facet)) { tags$div( class = "data-extract-box", diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 8dc670d03..947146f76 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -184,7 +184,16 @@ tm_g_distribution <- function(label = "Distribution Module", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + available_decorators <- c("default", "plot", "test_table", "summary_table") + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = available_decorators)) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = available_decorators) + # End of assertions # Make UI args diff --git a/R/tm_g_response.R b/R/tm_g_response.R index e94580bb0..1a7a7fcd8 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -202,13 +202,13 @@ tm_g_response <- function(label = "Response Plot", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { lapply(decorators, list) } else { list(default = decorators) } } - assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) + assert_decorators(decorators, null.ok = TRUE, names = c("default")) # End of assertions # Make UI args @@ -292,7 +292,7 @@ ui_g_response <- function(id, ...) { selected = ifelse(args$freq, "frequency", "density"), justified = TRUE ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index ec834e9b4..3c534abbd 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -309,13 +309,13 @@ tm_g_scatterplot <- function(label = "Scatterplot", checkmate::assert_class(ggplot2_args, "ggplot2_args") if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { lapply(decorators, list) } else { list(default = decorators) } } - assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) + assert_decorators(decorators, null.ok = TRUE, names = c("default")) # End of assertions @@ -439,7 +439,7 @@ ui_g_scatterplot <- function(id, ...) { is_single_dataset = is_single_dataset_value ) }, - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index db356d2b6..d4d2bd72e 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -204,13 +204,13 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "plot"))) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { lapply(decorators, list) } else { list(default = decorators) } } - assert_decorators(decorators, null.ok = TRUE, names = c("default", "plot")) + assert_decorators(decorators, null.ok = TRUE, names = c("default")) # End of assertions # Make UI args @@ -257,7 +257,7 @@ ui_g_scatterplotmatrix <- function(id, ...) { is_single_dataset = is_single_dataset_value ), tags$hr(), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 6199e5ad5..c7267d015 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -169,13 +169,13 @@ tm_t_crosstable <- function(label = "Cross Table", checkmate::assert_class(basic_table_args, classes = "basic_table_args") if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", "table"))) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { lapply(decorators, list) } else { list(default = decorators) } } - assert_decorators(decorators, null.ok = TRUE, names = c("default", "table")) + assert_decorators(decorators, null.ok = TRUE, names = c("default")) # End of assertions # Make UI args @@ -242,7 +242,7 @@ ui_t_crosstable <- function(id, x, y, show_percentage, show_total, pre_output, p checkboxInput(ns("show_total"), "Show total column", value = show_total) ) ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", args$decorators)) + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)) ), forms = tagList( teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") @@ -418,7 +418,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, decorated_output_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("table", decorators), + decorators = subset_decorators("default", decorators), expr = table ) diff --git a/man/srv_decorate_teal_data.Rd b/man/srv_decorate_teal_data.Rd index 6ed8a4399..46c8b37e7 100644 --- a/man/srv_decorate_teal_data.Rd +++ b/man/srv_decorate_teal_data.Rd @@ -10,10 +10,6 @@ srv_decorate_teal_data(id, data, decorators, expr, expr_is_reactive = FALSE) ui_decorate_teal_data(id, decorators, ...) } \arguments{ -\item{id}{(\code{character(1)}) Module id} - -\item{data}{(\verb{reactive teal_data})} - \item{expr}{(\code{expression} or \code{reactive}) to evaluate on the output of the decoration. When an expression it must be inline code. See \code{\link[=within]{within()}} Default is \code{NULL} which won't evaluate any appending code.} From 72b5d0587a19185a4e160b7b315278ebba36162a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:56:51 +0000 Subject: [PATCH 11/31] feat: tm_g_association --- R/tm_g_association.R | 43 +++++++++++++++++++---------------- man/srv_decorate_teal_data.Rd | 4 ++++ man/tm_g_association.Rd | 3 +-- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/R/tm_g_association.R b/R/tm_g_association.R index faa79ce1c..8d5297d63 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -28,8 +28,7 @@ #' @section Decorating `tm_g_association`: #' #' This module generates the following objects, which can be modified in place using decorators: -#' - `plot_top` (`ggplot2`) -#' - `plot_bottom` (`ggplot2`) +#' - `plot` (`grob` created with [ggplot2::ggplotGrob()]) #' #' For additional details and examples of decorators, refer to the vignette #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. @@ -176,7 +175,16 @@ tm_g_association <- function(label = "Association", plot_choices <- c("Bivariate1", "Bivariate2") checkmate::assert_list(ggplot2_args, types = "ggplot2_args") checkmate::assert_subset(names(ggplot2_args), c("default", plot_choices)) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) + + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = c("default")) + # End of assertions # Make UI args @@ -247,7 +255,7 @@ ui_tm_g_association <- function(id, ...) { "Log transformed", value = FALSE ), - ui_transform_teal_data(ns("decorate"), transformators = args$decorators), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -405,8 +413,6 @@ srv_tm_g_association <- function(id, # association ref_class_cov <- ifelse(association, ref_class, "NULL") - print_call <- quote(print(p)) - var_calls <- lapply(vars_names, function(var_i) { var_class <- class(ANL[[var_i]])[1] if (is.numeric(ANL[[var_i]]) && log_transformation) { @@ -488,6 +494,7 @@ srv_tm_g_association <- function(id, expr = { plot_top <- plot_calls[[1]] plot_bottom <- plot_calls[[1]] + plot <- tern::stack_grobs(grobs = lapply(list(plot_top, plot_bottom), ggplotGrob)) }, env = list( plot_calls = do.call( @@ -500,23 +507,19 @@ srv_tm_g_association <- function(id, ) }) - decorated_output_q <- srv_transform_teal_data("decorate", data = output_q, transformators = decorators) - decorated_output_grob_q <- reactive({ - within( - decorated_output_q(), - { - plot <- tern::stack_grobs(grobs = lapply(list(plot_top, plot_bottom), ggplotGrob)) - grid::grid.newpage() - grid::grid.draw(plot) - } - ) - }) - + decorated_output_grob_q <- srv_decorate_teal_data( + id = "decorator", + data = output_q, + decorators = subset_decorators("plot", decorators), + expr = { + grid::grid.newpage() + grid::grid.draw(plot) + } + ) plot_r <- reactive({ req(iv_r()$is_valid()) - req(output_q()) - decorated_output_grob_q()[["plot"]] + req(decorated_output_grob_q())[["plot"]] }) pws <- teal.widgets::plot_with_settings_srv( diff --git a/man/srv_decorate_teal_data.Rd b/man/srv_decorate_teal_data.Rd index 46c8b37e7..6ed8a4399 100644 --- a/man/srv_decorate_teal_data.Rd +++ b/man/srv_decorate_teal_data.Rd @@ -10,6 +10,10 @@ srv_decorate_teal_data(id, data, decorators, expr, expr_is_reactive = FALSE) ui_decorate_teal_data(id, decorators, ...) } \arguments{ +\item{id}{(\code{character(1)}) Module id} + +\item{data}{(\verb{reactive teal_data})} + \item{expr}{(\code{expression} or \code{reactive}) to evaluate on the output of the decoration. When an expression it must be inline code. See \code{\link[=within]{within()}} Default is \code{NULL} which won't evaluate any appending code.} diff --git a/man/tm_g_association.Rd b/man/tm_g_association.Rd index 347744189..b4d555604 100644 --- a/man/tm_g_association.Rd +++ b/man/tm_g_association.Rd @@ -79,8 +79,7 @@ For more examples, please see the vignette "Using association plot" via This module generates the following objects, which can be modified in place using decorators: \itemize{ -\item \code{plot_top} (\code{ggplot2}) -\item \code{plot_bottom} (\code{ggplot2}) +\item \code{plot} (\code{grob} created with \code{\link[ggplot2:ggplotGrob]{ggplot2::ggplotGrob()}}) } For additional details and examples of decorators, refer to the vignette From 7b8b8c0f74042a25f500fd2a3f2545a4bf19c913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:06:36 +0000 Subject: [PATCH 12/31] feat: tm_g_association --- R/tm_g_distribution.R | 19 +++++++++++++++++-- man/tm_g_distribution.Rd | 18 ++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 947146f76..cb105783c 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -29,11 +29,26 @@ #' #' @section Decorating `tm_outliers`: #' -#' This module generates the following objects, which can be modified in place using decorators: -#' - `plot` (`ggplot2`) +#' This module generates the following objects, which can be modified in place using decorators:: +#' - `plot` (`ggplot2`)` #' - `test_table` (`data.frame`) #' - `summary_table` (`data.frame`) #' +#' The `decorators` can be specific for the `histogram` and `decorators` outputs +#' within the module, which can be specified by using a named list. +#' See code snippet below: +#' +#' ``` +#' tm_g_distribution( +#' ..., # arguments for module +#' decorators = list( +#' default = list(teal_transform_module(...)), # applied to outputs of both `histogram` and `qq` +#' histogram = list(teal_transform_module(...)), # applied to outputs of `histogram` +#' qq = list(teal_transform_module(...)) # applied to outputs of `qq` +#' ) +#' ) +#' ``` +#' #' For additional details and examples of decorators, refer to the vignette #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. #' diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index dfbc4292f..36cd3cd37 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -80,13 +80,27 @@ visually and statistically analyze the variable's distribution. \section{Decorating \code{tm_outliers}}{ -This module generates the following objects, which can be modified in place using decorators: +This module generates the following objects, which can be modified in place using decorators:: \itemize{ -\item \code{plot} (\code{ggplot2}) +\item \code{plot} (\code{ggplot2})` \item \code{test_table} (\code{data.frame}) \item \code{summary_table} (\code{data.frame}) } +The \code{decorators} can be specific for the \code{histogram} and \code{decorators} outputs +within the module, which can be specified by using a named list. +See code snippet below: + +\if{html}{\out{
}}\preformatted{tm_g_distribution( + ..., # arguments for module + decorators = list( + default = list(teal_transform_module(...)), # applied to outputs of both `histogram` and `qq` + histogram = list(teal_transform_module(...)), # applied to outputs of `histogram` + qq = list(teal_transform_module(...)) # applied to outputs of `qq` + ) +) +}\if{html}{\out{
}} + For additional details and examples of decorators, refer to the vignette \code{vignette("decorate-modules-output", package = "teal")} or the \code{\link[=teal_transform_module]{teal_transform_module()}} documentation. } From ea3f7299f0541233e8377be2565780734ea0e13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:22:28 +0000 Subject: [PATCH 13/31] docs: first try at changing documentation for decorators arg --- R/utils.R | 13 ++++++++++++- man/shared_params.Rd | 15 +++++++++++++-- man/tm_a_pca.Rd | 15 +++++++++++++-- man/tm_a_regression.Rd | 15 +++++++++++++-- man/tm_data_table.Rd | 15 +++++++++++++-- man/tm_g_association.Rd | 15 +++++++++++++-- man/tm_g_bivariate.Rd | 15 +++++++++++++-- man/tm_g_distribution.Rd | 15 +++++++++++++-- man/tm_g_response.Rd | 15 +++++++++++++-- man/tm_g_scatterplot.Rd | 15 +++++++++++++-- man/tm_g_scatterplotmatrix.Rd | 15 +++++++++++++-- man/tm_missing_data.Rd | 15 +++++++++++++-- man/tm_outliers.Rd | 15 +++++++++++++-- man/tm_t_crosstable.Rd | 15 +++++++++++++-- 14 files changed, 181 insertions(+), 27 deletions(-) diff --git a/R/utils.R b/R/utils.R index aee278d38..e5927ead8 100644 --- a/R/utils.R +++ b/R/utils.R @@ -25,8 +25,19 @@ #' with text placed before the output to put the output into context. For example a title. #' @param post_output (`shiny.tag`) optional, text or UI element to be displayed after the module's output, #' adding context or further instructions. Elements like `shiny::helpText()` are useful. -#' @param decorators `r lifecycle::badge("experimental")` (`list` of `teal_transform_module` or `NULL`) optional, +#' @param decorators `r lifecycle::badge("experimental")` +#' (`list` of `teal_transform_module`, +#' named `list` of `teal_transform_module` or +#' `NULL`) optional, #' if not `NULL`, decorator for tables or plots included in the module. +#' When a named list of `teal_transform_module`, the decorators are applied to the +#' outputs of the corresponding view of the module. +#' Otherwise, the decorators are applied to all outputs in all views equally, which is the same +#' as using the name `default`. +#' +#' A module can have different views with different outputs, such as a tab with +#' a table and another with a plot. +#' See section "Decorating `tm_`" below for more details. #' #' @param alpha (`integer(1)` or `integer(3)`) optional, specifies point opacity. #' - When the length of `alpha` is one: the plot points will have a fixed opacity. diff --git a/man/shared_params.Rd b/man/shared_params.Rd index 1cf943565..ab875a15d 100644 --- a/man/shared_params.Rd +++ b/man/shared_params.Rd @@ -34,8 +34,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} \item{alpha}{(\code{integer(1)} or \code{integer(3)}) optional, specifies point opacity. \itemize{ diff --git a/man/tm_a_pca.Rd b/man/tm_a_pca.Rd index f5d2d052c..68a975b86 100644 --- a/man/tm_a_pca.Rd +++ b/man/tm_a_pca.Rd @@ -74,8 +74,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_a_regression.Rd b/man/tm_a_regression.Rd index 868e6562a..d4c64c74a 100644 --- a/man/tm_a_regression.Rd +++ b/man/tm_a_regression.Rd @@ -98,8 +98,19 @@ It takes the form of \code{c(value, min, max)} and it is passed to the \code{val argument in \code{teal.widgets::optionalSliderInputValMinMax}. }} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_data_table.Rd b/man/tm_data_table.Rd index 5661eb2ee..4b1b65f1e 100644 --- a/man/tm_data_table.Rd +++ b/man/tm_data_table.Rd @@ -48,8 +48,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_association.Rd b/man/tm_g_association.Rd index b4d555604..9045e196d 100644 --- a/man/tm_g_association.Rd +++ b/man/tm_g_association.Rd @@ -59,8 +59,19 @@ List names should match the following: \code{c("default", "Bivariate1", "Bivaria For more details see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_bivariate.Rd b/man/tm_g_bivariate.Rd index c8ad47e15..b982828c8 100644 --- a/man/tm_g_bivariate.Rd +++ b/man/tm_g_bivariate.Rd @@ -102,8 +102,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 36cd3cd37..d79df5ab8 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -66,8 +66,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, with text placed after the output to put the output into context. For example the \code{\link[shiny:helpText]{shiny::helpText()}} elements are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_response.Rd b/man/tm_g_response.Rd index 4dd5e9d33..132ea43b6 100644 --- a/man/tm_g_response.Rd +++ b/man/tm_g_response.Rd @@ -82,8 +82,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_scatterplot.Rd b/man/tm_g_scatterplot.Rd index 43439b489..274b0cc4c 100644 --- a/man/tm_g_scatterplot.Rd +++ b/man/tm_g_scatterplot.Rd @@ -95,8 +95,19 @@ The argument is merged with options variable \code{teal.ggplot2_args} and defaul For more details see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_scatterplotmatrix.Rd b/man/tm_g_scatterplotmatrix.Rd index 7a9cb9c0e..c966af169 100644 --- a/man/tm_g_scatterplotmatrix.Rd +++ b/man/tm_g_scatterplotmatrix.Rd @@ -36,8 +36,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index d5b1e919b..d7376caea 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -49,8 +49,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index f0244879d..d786d73c4 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -50,8 +50,19 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_t_crosstable.Rd b/man/tm_t_crosstable.Rd index 23ef6d6e2..fdcbc2985 100644 --- a/man/tm_t_crosstable.Rd +++ b/man/tm_t_crosstable.Rd @@ -51,8 +51,19 @@ The argument is merged with options variable \code{teal.basic_table_args} and de For more details see the vignette: \code{vignette("custom-basic-table-arguments", package = "teal.widgets")}} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module} or \code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} +(\code{list} of \code{teal_transform_module}, +named \code{list} of \code{teal_transform_module} or +\code{NULL}) optional, +if not \code{NULL}, decorator for tables or plots included in the module. +When a named list of \code{teal_transform_module}, the decorators are applied to the +outputs of the corresponding view of the module. +Otherwise, the decorators are applied to all outputs in all views equally, which is the same +as using the name \code{default}. + +A module can have different views with different outputs, such as a tab with +a table and another with a plot. +See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. From 6d5dea3cf6d4fe8e33a44aba2cc6cc6ecf8e7312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:46:59 +0000 Subject: [PATCH 14/31] docs: typo with extra backtick --- R/tm_g_distribution.R | 2 +- man/tm_g_distribution.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index cb105783c..519102900 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -30,7 +30,7 @@ #' @section Decorating `tm_outliers`: #' #' This module generates the following objects, which can be modified in place using decorators:: -#' - `plot` (`ggplot2`)` +#' - `plot` (`ggplot2`) #' - `test_table` (`data.frame`) #' - `summary_table` (`data.frame`) #' diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index d79df5ab8..0ea280ace 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -93,7 +93,7 @@ visually and statistically analyze the variable's distribution. This module generates the following objects, which can be modified in place using decorators:: \itemize{ -\item \code{plot} (\code{ggplot2})` +\item \code{plot} (\code{ggplot2}) \item \code{test_table} (\code{data.frame}) \item \code{summary_table} (\code{data.frame}) } From 668af6625c69f156aa4876bbe2cd2acfc4413fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:48:26 +0000 Subject: [PATCH 15/31] feat: tm_outliers --- R/tm_outliers.R | 184 +++++++++++++++++++++++++++------------------ man/tm_outliers.Rd | 3 +- 2 files changed, 114 insertions(+), 73 deletions(-) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index be3cc51f0..9e9f367ac 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -22,7 +22,8 @@ #' This module generates the following objects, which can be modified in place using decorators: #' - `box_plot` (`ggplot2`) #' - `density_plot` (`ggplot2`) -#' - `cum_dist_plot` (`ggplot2`) +#' - `cumulative_plot` (`ggplot2`) +#' - `table` ([DT::datatable()]) #' #' For additional details and examples of decorators, refer to the vignette #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. @@ -178,8 +179,15 @@ tm_outliers <- function(label = "Outliers Module", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) - + available_decorators <- c("box_plot", "density_plot", "cumulative_plot", "table") + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", available_decorators))) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } + assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions # Make UI args @@ -322,7 +330,19 @@ ui_outliers <- function(id, ...) { uiOutput(ns("ui_outlier_help")) ) ), - ui_transform_teal_data(ns("decorate"), transformators = args$decorators), + conditionalPanel( + condition = paste0("input['", ns("tabs"), "'] == 'Boxplot'"), + ui_decorate_teal_data(ns("d_box_plot"), decorators = subset_decorators("box_plot", args$decorators)) + ), + conditionalPanel( + condition = paste0("input['", ns("tabs"), "'] == 'Density Plot'"), + ui_decorate_teal_data(ns("d_density_plot"), decorators = subset_decorators("density_plot", args$decorators)) + ), + conditionalPanel( + condition = paste0("input['", ns("tabs"), "'] == 'Cumulative Distribution Plot'"), + ui_decorate_teal_data(ns("d_cumulative_plot"), decorators = subset_decorators("cumulative_plot", args$decorators)) + ), + ui_decorate_teal_data(ns("d_table"), decorators = subset_decorators("table", args$decorators)), teal.widgets::panel_item( title = "Plot settings", selectInput( @@ -585,7 +605,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) ) - if (length(categorical_var) > 0) { + qenv <- if (length(categorical_var) > 0) { qenv <- teal.code::eval_code( qenv, substitute( @@ -641,7 +661,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) } - qenv <- teal.code::eval_code( + teal.code::eval_code( qenv, substitute( expr = { @@ -669,7 +689,6 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, tidyr::pivot_longer(-categorical_var_name) %>% tidyr::pivot_wider(names_from = categorical_var, values_from = value) %>% tibble::column_to_rownames("name") - summary_table }, env = list( categorical_var = categorical_var, @@ -677,8 +696,22 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) ) ) + } else { + within(qenv, summary_table <- data.frame()) } + # Datatable is generated in qenv to allow for output decoration + qenv <- within(qenv, { + table <- DT::datatable( + summary_table, + options = list( + dom = "t", + autoWidth = TRUE, + columnDefs = list(list(width = "200px", targets = "_all")) + ) + ) + }) + if (length(categorical_var) > 0 && nrow(qenv[["ANL_OUTLIER"]]) > 0) { shinyjs::show("order_by_outlier") } else { @@ -688,26 +721,8 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, qenv }) - output$summary_table <- DT::renderDataTable( - expr = { - if (iv_r()$is_valid()) { - categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) - if (!is.null(categorical_var)) { - DT::datatable( - common_code_q()[["summary_table"]], - options = list( - dom = "t", - autoWidth = TRUE, - columnDefs = list(list(width = "200px", targets = "_all")) - ) - ) - } - } - } - ) - # boxplot/violinplot # nolint commented_code - boxplot_q <- reactive({ + box_plot_q <- reactive({ req(common_code_q()) ANL <- common_code_q()[["ANL"]] ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] @@ -947,7 +962,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.code::eval_code( qenv, substitute( - expr = cum_dist_plot <- plot_call + + expr = cumulative_plot <- plot_call + geom_point(data = outlier_points, aes(x = outlier_var_name, y = y, color = is_outlier_selected)) + scale_color_manual(values = c("TRUE" = "red", "FALSE" = "black")) + labs + ggthemes + themes, @@ -962,37 +977,61 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) }) - final_q <- reactive({ - req(input$tabs) - tab_type <- input$tabs - result_q <- if (tab_type == "Boxplot") { - boxplot_q() - } else if (tab_type == "Density Plot") { - density_plot_q() - } else if (tab_type == "Cumulative Distribution Plot") { - cumulative_plot_q() - } - # used to display table when running show-r-code code - # added after the plots so that a change in selected columns doesn't affect - # brush selection. - teal.code::eval_code( - result_q, - substitute( - expr = { - columns_index <- union( - setdiff(names(ANL_OUTLIER), c("is_outlier_selected", "order")), - table_columns - ) - ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] - }, - env = list( - table_columns = input$table_ui_columns + current_tab_r <- reactive({ + switch(req(input$tabs), + "Boxplot" = "box_plot", + "Density Plot" = "density_plot", + "Cumulative Distribution Plot" = "cumulative_plot" + ) + }) + + post_expr <- reactive({ + substitute( + expr = { + columns_index <- union( + setdiff(names(ANL_OUTLIER), c("is_outlier_selected", "order")), + table_columns ) - ) + ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] + print(.plot) + }, + env = list(table_columns = input$table_ui_columns, .plot = as.name(current_tab_r())) ) }) - decorated_final_q <- srv_transform_teal_data("decorate", data = final_q, transformators = decorators) + decorated_q <- mapply( + function(obj_name, q) { + srv_decorate_teal_data( + id = sprintf("d_%s", obj_name), + data = q, + decorators = subset_decorators(obj_name, decorators), + expr = post_expr, + expr_is_reactive = TRUE + ) + }, + rlang::set_names(c("box_plot", "density_plot", "cumulative_plot")), + c(box_plot_q, density_plot_q, cumulative_plot_q) + ) + + decorated_final_q_no_table <- reactive(decorated_q[[req(current_tab_r())]]()) + + decorated_final_q <- srv_decorate_teal_data( + "d_table", + data = decorated_final_q_no_table, + decorators = subset_decorators("table", decorators), + expr = table + ) + + output$summary_table <- DT::renderDataTable( + expr = { + if (iv_r()$is_valid()) { + categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var) + if (!is.null(categorical_var)) { + decorated_final_q()[["table"]] + } + } + } + ) # slider text output$ui_outlier_help <- renderUI({ @@ -1042,25 +1081,22 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, } }) - boxplot_r <- reactive({ + box_plot_r <- reactive({ teal::validate_inputs(iv_r()) - req(boxplot_q()) - decorated_final_q()[["box_plot"]] + req(decorated_q$box_plot())[["box_plot"]] }) density_plot_r <- reactive({ teal::validate_inputs(iv_r()) - req(density_plot_q()) - decorated_final_q()[["density_plot"]] + req(decorated_q$density_plot())[["density_plot"]] }) cumulative_plot_r <- reactive({ teal::validate_inputs(iv_r()) - req(cumulative_plot_q()) - decorated_final_q()[["cum_dist_plot"]] + req(decorated_q$cumulative_plot())[["cumulative_plot"]] }) box_pws <- teal.widgets::plot_with_settings_srv( id = "box_plot", - plot_r = boxplot_r, + plot_r = box_plot_r, height = plot_height, width = plot_width, brushing = TRUE @@ -1106,16 +1142,20 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ANL_OUTLIER_EXTENDED <- common_code_q()[["ANL_OUTLIER_EXTENDED"]] ANL <- common_code_q()[["ANL"]] - plot_brush <- if (tab == "Boxplot") { - boxplot_r() - box_pws$brush() - } else if (tab == "Density Plot") { - density_plot_r() - density_pws$brush() - } else if (tab == "Cumulative Distribution Plot") { - cumulative_plot_r() - cum_density_pws$brush() - } + plot_brush <- switch(current_tab_r(), + box_plot = { + box_plot_r() + box_pws$brush() + }, + density_plot = { + density_plot_r() + density_pws$brush() + }, + cumulative_plot = { + cumulative_plot_r() + cum_density_pws$brush() + } + ) # removing unused column ASAP ANL_OUTLIER$order <- ANL$order <- NULL diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index d786d73c4..f92668f63 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -79,7 +79,8 @@ This module generates the following objects, which can be modified in place usin \itemize{ \item \code{box_plot} (\code{ggplot2}) \item \code{density_plot} (\code{ggplot2}) -\item \code{cum_dist_plot} (\code{ggplot2}) +\item \code{cumulative_plot} (\code{ggplot2}) +\item \code{table} (\code{\link[DT:datatable]{DT::datatable()}}) } For additional details and examples of decorators, refer to the vignette From ea8d583d165e5ef47ddc2cf2454f02bcc14b042b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:16:14 +0000 Subject: [PATCH 16/31] feat: unifying documentation --- R/roxygen2_templates.R | 30 ++++++++++++++++++++++++++++ R/tm_a_pca.R | 4 ++-- R/tm_a_regression.R | 13 +++++++----- R/tm_g_association.R | 4 ++-- R/tm_g_distribution.R | 16 ++++++++------- R/tm_missing_data.R | 8 ++++++-- R/tm_outliers.R | 5 ++--- R/utils.R | 14 ------------- man-roxygen/ggplot2_args_multi.R | 7 ------- man/shared_params.Rd | 14 ------------- man/tm_a_pca.Rd | 22 ++++++--------------- man/tm_a_regression.Rd | 24 +++++++--------------- man/tm_data_table.Rd | 14 ------------- man/tm_g_association.Rd | 22 ++++++--------------- man/tm_g_bivariate.Rd | 14 ------------- man/tm_g_distribution.Rd | 34 ++++++++++++-------------------- man/tm_g_response.Rd | 14 ------------- man/tm_g_scatterplot.Rd | 14 ------------- man/tm_g_scatterplotmatrix.Rd | 14 ------------- man/tm_missing_data.Rd | 22 ++++++--------------- man/tm_outliers.Rd | 24 +++++++--------------- man/tm_t_crosstable.Rd | 14 ------------- 22 files changed, 104 insertions(+), 243 deletions(-) create mode 100644 R/roxygen2_templates.R delete mode 100644 man-roxygen/ggplot2_args_multi.R diff --git a/R/roxygen2_templates.R b/R/roxygen2_templates.R new file mode 100644 index 000000000..d55c2aef4 --- /dev/null +++ b/R/roxygen2_templates.R @@ -0,0 +1,30 @@ +# nocov start +roxygen_decorators_param <- function(module_name) { + paste( + sep = " ", + lifecycle::badge("experimental"), + " (`list` of `teal_transform_module`, named `list` of `teal_transform_module` or", + "`NULL`) optional, if not `NULL`, decorator for tables or plots included in the module.", + "When a named list of `teal_transform_module`, the decorators are applied to the", + "respective output objects.\n\n", + "Otherwise, the decorators are applied to all objects, which is equivalent as using the name `default`.\n\n", + sprintf("See section \"Decorating `%s`\"", module_name), + "below for more details." + ) +} + +roxygen_ggplot2_args_param <- function(...) { + paste( + sep = " ", + "(`ggplot2_args`) optional, object created by [`teal.widgets::ggplot2_args()`]", + "with settings for all the plots or named list of `ggplot2_args` objects for plot-specific settings.", + "The argument is merged with options variable `teal.ggplot2_args` and default module setup.\n\n", + sprintf( + "List names should match the following: `c(\"default\", %s)`.\n\n", + paste("\"", unlist(rlang::list2(...)), "\"", collapse = ", ", sep = "") + ), + "For more details see the vignette: `vignette(\"custom-ggplot2-arguments\", package = \"teal.widgets\")`." + ) +} + +# nocov end diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 09af523fa..33775955e 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -13,8 +13,8 @@ #' It controls the font size for plot titles, axis labels, and legends. #' - If vector of `length == 1` then the font sizes will have a fixed size. #' - while vector of `value`, `min`, and `max` allows dynamic adjustment. -#' @templateVar ggnames "Elbow plot", "Circle plot", "Biplot", "Eigenvector plot" -#' @template ggplot2_args_multi +#' @param ggplot2_args `r roxygen_ggplot2_args_param("Elbow plot", "Circle plot", "Biplot", "Eigenvector plot")` +#' @param decorators `r roxygen_decorators_param("tm_a_pca")` #' #' @inherit shared_params return #' diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index b0e4d49ec..9ccd3be16 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -37,8 +37,8 @@ #' It takes the form of `c(value, min, max)` and it is passed to the `value_min_max` #' argument in `teal.widgets::optionalSliderInputValMinMax`. #' -#' @templateVar ggnames `r regression_names` -#' @template ggplot2_args_multi +#' @param ggplot2_args `r roxygen_ggplot2_args_param(regression_names)` +#' @param decorators `r roxygen_decorators_param("tm_a_regression")` #' #' @inherit shared_params return #' @@ -1035,7 +1035,10 @@ srv_a_regression <- function(id, }) } -regression_names <- paste0( - '"Response vs Regressor", "Residuals vs Fitted", ', - '"Scale-Location", "Cook\'s distance", "Residuals vs Leverage"", "Cook\'s dist vs Leverage"' +regression_names <- c( + "Response vs Regressor", + "Residuals vs Fitted", + "Scale-Location", "Cook's distance", + "Residuals vs Leverage", + "Cook's dist vs Leverage" ) diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 8d5297d63..e4f9bcbe0 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -20,8 +20,8 @@ #' @param distribution_theme,association_theme (`character`) optional, `ggplot2` themes to be used by default. #' Default to `"gray"`. #' -#' @templateVar ggnames "Bivariate1", "Bivariate2" -#' @template ggplot2_args_multi +#' @param ggplot2_args `r roxygen_ggplot2_args_param("Bivariate1", "Bivariate2")` +#' @param decorators `r roxygen_decorators_param("tm_")` #' #' @inherit shared_params return #' diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 519102900..3aa508da6 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -22,8 +22,8 @@ #' and `max`. #' Defaults to `c(30L, 1L, 100L)`. #' -#' @templateVar ggnames "Histogram", "QQplot" -#' @template ggplot2_args_multi +#' @param ggplot2_args `r roxygen_ggplot2_args_param("Histogram", "QQplot")` +#' @param decorators `r roxygen_decorators_param("tm_g_distribution")` #' #' @inherit shared_params return #' @@ -34,17 +34,19 @@ #' - `test_table` (`data.frame`) #' - `summary_table` (`data.frame`) #' -#' The `decorators` can be specific for the `histogram` and `decorators` outputs -#' within the module, which can be specified by using a named list. +#' Decorators can be applied to all outputs or only to specific objects using a +#' named list of `teal_transform_module` objects. +#' The `"default"` name is reserved for decorators that are applied to all outputs. #' See code snippet below: #' #' ``` #' tm_g_distribution( #' ..., # arguments for module #' decorators = list( -#' default = list(teal_transform_module(...)), # applied to outputs of both `histogram` and `qq` -#' histogram = list(teal_transform_module(...)), # applied to outputs of `histogram` -#' qq = list(teal_transform_module(...)) # applied to outputs of `qq` +#' default = list(teal_transform_module(...)), # applied to all outputs +#' plot = list(teal_transform_module(...)), # applied only to plot output (histogram plot) +#' test_table = list(teal_transform_module(...)) # applied only to test_table +#' summary_table = list(teal_transform_module(...)) # applied only to summary_table #' ) #' ) #' ``` diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 027ba182b..d6971c6f8 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -12,8 +12,8 @@ #' ignored. #' @param ggtheme (`character`) optional, specifies the default `ggplot2` theme for plots. Defaults to `classic`. #' -#' @templateVar ggnames "Summary Obs", "Summary Patients", "Combinations Main", "Combinations Hist", "By Subject" -#' @template ggplot2_args_multi +#' @param ggplot2_args `r roxygen_ggplot2_args_param(missing_data_names)` +#' @param decorators `r roxygen_decorators_param("tm_missing_data")` #' #' @inherit shared_params return #' @@ -1393,3 +1393,7 @@ srv_missing_data <- function(id, ### }) } + +missing_data_names <- c( + "Summary Obs", "Summary Patients", "Combinations Main", "Combinations Hist", "By Subject" +) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 9e9f367ac..66e7c5689 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -11,9 +11,8 @@ #' Specifies variable(s) to be analyzed for outliers. #' @param categorical_var (`data_extract_spec` or `list` of multiple `data_extract_spec`) optional, #' specifies the categorical variable(s) to split the selected outlier variables on. -#' -#' @templateVar ggnames "Boxplot","Density Plot","Cumulative Distribution Plot" -#' @template ggplot2_args_multi +#' @param decorators `r roxygen_decorators_param("tm_outliers")` +#' @param ggplot2_args `r roxygen_ggplot2_args_param("Boxplot", "Density Plot", "Cumulative Distribution Plot")` #' #' @inherit shared_params return #' diff --git a/R/utils.R b/R/utils.R index e5927ead8..87b53e55a 100644 --- a/R/utils.R +++ b/R/utils.R @@ -25,20 +25,6 @@ #' with text placed before the output to put the output into context. For example a title. #' @param post_output (`shiny.tag`) optional, text or UI element to be displayed after the module's output, #' adding context or further instructions. Elements like `shiny::helpText()` are useful. -#' @param decorators `r lifecycle::badge("experimental")` -#' (`list` of `teal_transform_module`, -#' named `list` of `teal_transform_module` or -#' `NULL`) optional, -#' if not `NULL`, decorator for tables or plots included in the module. -#' When a named list of `teal_transform_module`, the decorators are applied to the -#' outputs of the corresponding view of the module. -#' Otherwise, the decorators are applied to all outputs in all views equally, which is the same -#' as using the name `default`. -#' -#' A module can have different views with different outputs, such as a tab with -#' a table and another with a plot. -#' See section "Decorating `tm_`" below for more details. -#' #' @param alpha (`integer(1)` or `integer(3)`) optional, specifies point opacity. #' - When the length of `alpha` is one: the plot points will have a fixed opacity. #' - When the length of `alpha` is three: the plot points opacity are dynamically adjusted based on diff --git a/man-roxygen/ggplot2_args_multi.R b/man-roxygen/ggplot2_args_multi.R deleted file mode 100644 index dc0497942..000000000 --- a/man-roxygen/ggplot2_args_multi.R +++ /dev/null @@ -1,7 +0,0 @@ -#' @param ggplot2_args (`ggplot2_args`) optional, object created by [`teal.widgets::ggplot2_args()`] -#' with settings for all the plots or named list of `ggplot2_args` objects for plot-specific settings. -#' The argument is merged with options variable `teal.ggplot2_args` and default module setup. -#' -#' List names should match the following: `c("default", <%=ggnames%>)`. -#' -#' For more details see the vignette: `vignette("custom-ggplot2-arguments", package = "teal.widgets")`. diff --git a/man/shared_params.Rd b/man/shared_params.Rd index ab875a15d..1ea6b7094 100644 --- a/man/shared_params.Rd +++ b/man/shared_params.Rd @@ -34,20 +34,6 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} - \item{alpha}{(\code{integer(1)} or \code{integer(3)}) optional, specifies point opacity. \itemize{ \item When the length of \code{alpha} is one: the plot points will have a fixed opacity. diff --git a/man/tm_a_pca.Rd b/man/tm_a_pca.Rd index 68a975b86..47b48deea 100644 --- a/man/tm_a_pca.Rd +++ b/man/tm_a_pca.Rd @@ -35,9 +35,7 @@ specifying columns used to compute PCA.} \item{ggtheme}{(\code{character}) optional, \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} -\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} -with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. -The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. +\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. List names should match the following: \code{c("default", "Elbow plot", "Circle plot", "Biplot", "Eigenvector plot")}. @@ -74,19 +72,11 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module}, named \code{list} of \code{teal_transform_module} or \code{NULL}) optional, if not \code{NULL}, decorator for tables or plots included in the module. When a named list of \code{teal_transform_module}, the decorators are applied to the respective output objects. + +Otherwise, the decorators are applied to all objects, which is equivalent as using the name \code{default}. + +See section "Decorating \code{tm_a_pca}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_a_regression.Rd b/man/tm_a_regression.Rd index d4c64c74a..9d61c4805 100644 --- a/man/tm_a_regression.Rd +++ b/man/tm_a_regression.Rd @@ -54,11 +54,9 @@ vector of \code{value}, \code{min}, and \code{max}. \item{ggtheme}{(\code{character}) optional, \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} -\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} -with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. -The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. +\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. -List names should match the following: \verb{c("default", "Response vs Regressor", "Residuals vs Fitted", "Scale-Location", "Cook's distance", "Residuals vs Leverage"", "Cook's dist vs Leverage")}. +List names should match the following: \code{c("default", "Response vs Regressor", "Residuals vs Fitted", "Scale-Location", "Cook's distance", "Residuals vs Leverage", "Cook's dist vs Leverage")}. For more details see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}.} @@ -98,19 +96,11 @@ It takes the form of \code{c(value, min, max)} and it is passed to the \code{val argument in \code{teal.widgets::optionalSliderInputValMinMax}. }} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module}, named \code{list} of \code{teal_transform_module} or \code{NULL}) optional, if not \code{NULL}, decorator for tables or plots included in the module. When a named list of \code{teal_transform_module}, the decorators are applied to the respective output objects. + +Otherwise, the decorators are applied to all objects, which is equivalent as using the name \code{default}. + +See section "Decorating \code{tm_a_regression}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_data_table.Rd b/man/tm_data_table.Rd index 4b1b65f1e..c310c2b62 100644 --- a/man/tm_data_table.Rd +++ b/man/tm_data_table.Rd @@ -47,20 +47,6 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} - -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_association.Rd b/man/tm_g_association.Rd index 9045e196d..c4c79b452 100644 --- a/man/tm_g_association.Rd +++ b/man/tm_g_association.Rd @@ -51,27 +51,17 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} -with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. -The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. +\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. List names should match the following: \code{c("default", "Bivariate1", "Bivariate2")}. For more details see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module}, named \code{list} of \code{teal_transform_module} or \code{NULL}) optional, if not \code{NULL}, decorator for tables or plots included in the module. When a named list of \code{teal_transform_module}, the decorators are applied to the respective output objects. + +Otherwise, the decorators are applied to all objects, which is equivalent as using the name \code{default}. + +See section "Decorating \code{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_bivariate.Rd b/man/tm_g_bivariate.Rd index b982828c8..4a738e349 100644 --- a/man/tm_g_bivariate.Rd +++ b/man/tm_g_bivariate.Rd @@ -101,20 +101,6 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} - -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 0ea280ace..550473e4a 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -38,9 +38,7 @@ Defaults to density (\code{FALSE}).} \item{ggtheme}{(\code{character}) optional, \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} -\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} -with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. -The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. +\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. List names should match the following: \code{c("default", "Histogram", "QQplot")}. @@ -66,19 +64,11 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, with text placed after the output to put the output into context. For example the \code{\link[shiny:helpText]{shiny::helpText()}} elements are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module}, named \code{list} of \code{teal_transform_module} or \code{NULL}) optional, if not \code{NULL}, decorator for tables or plots included in the module. When a named list of \code{teal_transform_module}, the decorators are applied to the respective output objects. + +Otherwise, the decorators are applied to all objects, which is equivalent as using the name \code{default}. + +See section "Decorating \code{tm_g_distribution}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. @@ -98,16 +88,18 @@ This module generates the following objects, which can be modified in place usin \item \code{summary_table} (\code{data.frame}) } -The \code{decorators} can be specific for the \code{histogram} and \code{decorators} outputs -within the module, which can be specified by using a named list. +Decorators can be applied to all outputs or only to specific objects using a +named list of \code{teal_transform_module} objects. +The \code{"default"} name is reserved for decorators that are applied to all outputs. See code snippet below: \if{html}{\out{
}}\preformatted{tm_g_distribution( ..., # arguments for module decorators = list( - default = list(teal_transform_module(...)), # applied to outputs of both `histogram` and `qq` - histogram = list(teal_transform_module(...)), # applied to outputs of `histogram` - qq = list(teal_transform_module(...)) # applied to outputs of `qq` + default = list(teal_transform_module(...)), # applied to all outputs + plot = list(teal_transform_module(...)), # applied only to plot output (histogram plot) + test_table = list(teal_transform_module(...)) # applied only to test_table + summary_table = list(teal_transform_module(...)) # applied only to summary_table ) ) }\if{html}{\out{
}} diff --git a/man/tm_g_response.Rd b/man/tm_g_response.Rd index 132ea43b6..3f94a82c4 100644 --- a/man/tm_g_response.Rd +++ b/man/tm_g_response.Rd @@ -81,20 +81,6 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} - -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_scatterplot.Rd b/man/tm_g_scatterplot.Rd index 274b0cc4c..66f4bd84c 100644 --- a/man/tm_g_scatterplot.Rd +++ b/man/tm_g_scatterplot.Rd @@ -94,20 +94,6 @@ with settings for the module plot. The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. For more details see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}} - -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_g_scatterplotmatrix.Rd b/man/tm_g_scatterplotmatrix.Rd index c966af169..4cd3d9998 100644 --- a/man/tm_g_scatterplotmatrix.Rd +++ b/man/tm_g_scatterplotmatrix.Rd @@ -35,20 +35,6 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} - -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index d7376caea..63f36d576 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -34,9 +34,7 @@ ignored.} \item{ggtheme}{(\code{character}) optional, specifies the default \code{ggplot2} theme for plots. Defaults to \code{classic}.} -\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} -with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. -The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. +\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. List names should match the following: \code{c("default", "Summary Obs", "Summary Patients", "Combinations Main", "Combinations Hist", "By Subject")}. @@ -49,19 +47,11 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module}, named \code{list} of \code{teal_transform_module} or \code{NULL}) optional, if not \code{NULL}, decorator for tables or plots included in the module. When a named list of \code{teal_transform_module}, the decorators are applied to the respective output objects. + +Otherwise, the decorators are applied to all objects, which is equivalent as using the name \code{default}. + +See section "Decorating \code{tm_missing_data}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index f92668f63..9133be55c 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -29,11 +29,9 @@ specifies the categorical variable(s) to split the selected outlier variables on \item{ggtheme}{(\code{character}) optional, \code{ggplot2} theme to be used by default. Defaults to \code{"gray"}.} -\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} -with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. -The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. +\item{ggplot2_args}{(\code{ggplot2_args}) optional, object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for all the plots or named list of \code{ggplot2_args} objects for plot-specific settings. The argument is merged with options variable \code{teal.ggplot2_args} and default module setup. -List names should match the following: \code{c("default", "Boxplot","Density Plot","Cumulative Distribution Plot")}. +List names should match the following: \code{c("default", "Boxplot", "Density Plot", "Cumulative Distribution Plot")}. For more details see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}.} @@ -50,19 +48,11 @@ with text placed before the output to put the output into context. For example a \item{post_output}{(\code{shiny.tag}) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements like \code{shiny::helpText()} are useful.} -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} +\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} (\code{list} of \code{teal_transform_module}, named \code{list} of \code{teal_transform_module} or \code{NULL}) optional, if not \code{NULL}, decorator for tables or plots included in the module. When a named list of \code{teal_transform_module}, the decorators are applied to the respective output objects. + +Otherwise, the decorators are applied to all objects, which is equivalent as using the name \code{default}. + +See section "Decorating \code{tm_outliers}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. diff --git a/man/tm_t_crosstable.Rd b/man/tm_t_crosstable.Rd index fdcbc2985..3a4c0d8a2 100644 --- a/man/tm_t_crosstable.Rd +++ b/man/tm_t_crosstable.Rd @@ -50,20 +50,6 @@ with settings for the module table. The argument is merged with options variable \code{teal.basic_table_args} and default module setup. For more details see the vignette: \code{vignette("custom-basic-table-arguments", package = "teal.widgets")}} - -\item{decorators}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -(\code{list} of \code{teal_transform_module}, -named \code{list} of \code{teal_transform_module} or -\code{NULL}) optional, -if not \code{NULL}, decorator for tables or plots included in the module. -When a named list of \code{teal_transform_module}, the decorators are applied to the -outputs of the corresponding view of the module. -Otherwise, the decorators are applied to all outputs in all views equally, which is the same -as using the name \code{default}. - -A module can have different views with different outputs, such as a tab with -a table and another with a plot. -See section "Decorating \verb{tm_}" below for more details.} } \value{ Object of class \code{teal_module} to be used in \code{teal} applications. From 2f9f79b3263d1e778e24d5b0bd5561ed57b17673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:17:42 +0000 Subject: [PATCH 17/31] feat: use common function to normalize decorators --- R/tm_a_pca.R | 10 ++-------- R/tm_data_table.R | 10 ++-------- R/tm_g_association.R | 10 ++-------- R/tm_g_bivariate.R | 10 ++-------- R/tm_g_distribution.R | 10 ++-------- R/tm_g_response.R | 10 ++-------- R/tm_g_scatterplot.R | 10 ++-------- R/tm_g_scatterplotmatrix.R | 10 ++-------- R/tm_missing_data.R | 10 ++-------- R/tm_outliers.R | 8 +------- R/tm_t_crosstable.R | 10 ++-------- R/utils.R | 19 +++++++++++++++++++ 12 files changed, 40 insertions(+), 87 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 33775955e..50548b063 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -165,14 +165,8 @@ tm_a_pca <- function(label = "Principal Component Analysis", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions # Make UI args diff --git a/R/tm_data_table.R b/R/tm_data_table.R index ccf229220..737b258f6 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -131,14 +131,8 @@ tm_data_table <- function(label = "Data Table", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions ans <- module( diff --git a/R/tm_g_association.R b/R/tm_g_association.R index e4f9bcbe0..822e74486 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -176,14 +176,8 @@ tm_g_association <- function(label = "Association", checkmate::assert_list(ggplot2_args, types = "ggplot2_args") checkmate::assert_subset(names(ggplot2_args), c("default", plot_choices)) - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 861b20f1f..5e0dc5355 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -276,14 +276,8 @@ tm_g_bivariate <- function(label = "Bivariate Plots", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions # Make UI args diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 3aa508da6..8126fd1df 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -201,14 +201,8 @@ tm_g_distribution <- function(label = "Distribution Module", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - available_decorators <- c("default", "plot", "test_table", "summary_table") - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = available_decorators)) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } + available_decorators <- c("plot", "test_table", "summary_table") + decorators <- normalize_decorators(decorators, available_decorators) assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions diff --git a/R/tm_g_response.R b/R/tm_g_response.R index 1a7a7fcd8..229b257f0 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -201,14 +201,8 @@ tm_g_response <- function(label = "Response Plot", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions # Make UI args diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 3c534abbd..296a05af9 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -308,14 +308,8 @@ tm_g_scatterplot <- function(label = "Scatterplot", checkmate::assert_scalar(table_dec) checkmate::assert_class(ggplot2_args, "ggplot2_args") - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index d4d2bd72e..0f2c4866e 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -203,14 +203,8 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions # Make UI args diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index d6971c6f8..fb18b192c 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -135,14 +135,8 @@ tm_missing_data <- function(label = "Missing data", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) available_decorators <- c("summary_plot", "summary_plot", "combination_plot", "by_subject_plot", "summary_table") - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", available_decorators))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default", available_decorators)) + decorators <- normalize_decorators(decorators, available_decorators) + assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions ans <- module( diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 66e7c5689..1265ee572 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -179,13 +179,7 @@ tm_outliers <- function(label = "Outliers Module", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) available_decorators <- c("box_plot", "density_plot", "cumulative_plot", "table") - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default", available_decorators))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } + decorators <- normalize_decorators(decorators, available_decorators) assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index c7267d015..2f7ce32bd 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -168,14 +168,8 @@ tm_t_crosstable <- function(label = "Cross Table", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_class(basic_table_args, classes = "basic_table_args") - if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = c("default"))) { - lapply(decorators, list) - } else { - list(default = decorators) - } - } - assert_decorators(decorators, null.ok = TRUE, names = c("default")) + decorators <- normalize_decorators(decorators) + assert_decorators(decorators, null.ok = TRUE) # End of assertions # Make UI args diff --git a/R/utils.R b/R/utils.R index 87b53e55a..6360e16a6 100644 --- a/R/utils.R +++ b/R/utils.R @@ -390,3 +390,22 @@ subset_decorators <- function(scope, decorators) { scope <- intersect(union("default", scope), names(decorators)) c(list(), unlist(decorators[scope], recursive = FALSE)) } + +#' Convert flat list of `teal_transform_module` to named lists +#' +#' @param decorators (list of `teal_transformodules`) to normalize. +#' @param available_decorators (`character`) a character vector of available decorator names. +#' When `NULL` it assumes that all decorators should be applied, which can be used +#' when module only has 1 object. +#' @return A named list of lists with `teal_transform_module` objects. +#' @keywords internal +normalize_decorators <- function(decorators, available_decorators = NULL) { + available_decorators <- union("default", available_decorators) + if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { + decorators <- if (checkmate::test_names(names(decorators), subset.of = available_decorators)) { + lapply(decorators, list) + } else { + list(default = decorators) + } + } +} From bb52cf6c152ce9b0c5be9a7e162e6a224a6c8b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:22:00 +0000 Subject: [PATCH 18/31] docs: update docs on other complex modules with more than 1 decorateable output --- R/tm_g_distribution.R | 6 +++--- R/tm_missing_data.R | 18 ++++++++++++++++++ R/tm_outliers.R | 18 ++++++++++++++++++ man/tm_g_distribution.Rd | 6 +++--- man/tm_missing_data.Rd | 17 +++++++++++++++++ man/tm_outliers.Rd | 17 +++++++++++++++++ 6 files changed, 76 insertions(+), 6 deletions(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 8126fd1df..db939580c 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -44,9 +44,9 @@ #' ..., # arguments for module #' decorators = list( #' default = list(teal_transform_module(...)), # applied to all outputs -#' plot = list(teal_transform_module(...)), # applied only to plot output (histogram plot) -#' test_table = list(teal_transform_module(...)) # applied only to test_table -#' summary_table = list(teal_transform_module(...)) # applied only to summary_table +#' plot = list(teal_transform_module(...)), # applied only to `plot` output (histogram plot) +#' test_table = list(teal_transform_module(...)) # applied only to `test_table` output +#' summary_table = list(teal_transform_module(...)) # applied only to `summary_table` output #' ) #' ) #' ``` diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index fb18b192c..33de73d09 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -25,6 +25,24 @@ #' - `by_subject_plot` (`ggplot2`) #' - `table` ([DT::datatable()]) #' +#' Decorators can be applied to all outputs or only to specific objects using a +#' named list of `teal_transform_module` objects. +#' The `"default"` name is reserved for decorators that are applied to all outputs. +#' See code snippet below: +#' +#' ``` +#' tm_missing_data( +#' ..., # arguments for module +#' decorators = list( +#' default = list(teal_transform_module(...)), # applied to all outputs +#' summary_plot = list(teal_transform_module(...)), # applied only to `summary_plot` output +#' combination_plot = list(teal_transform_module(...)) # applied only to `combination_plot` output +#' by_subject_plot = list(teal_transform_module(...)) # applied only to `by_subject_plot` output +#' table = list(teal_transform_module(...)) # applied only to `table` output +#' ) +#' ) +#' ``` +#' #' For additional details and examples of decorators, refer to the vignette #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. #' diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 1265ee572..d9d8d6849 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -24,6 +24,24 @@ #' - `cumulative_plot` (`ggplot2`) #' - `table` ([DT::datatable()]) #' +#' Decorators can be applied to all outputs or only to specific objects using a +#' named list of `teal_transform_module` objects. +#' The `"default"` name is reserved for decorators that are applied to all outputs. +#' See code snippet below: +#' +#' ``` +#' tm_outliers( +#' ..., # arguments for module +#' decorators = list( +#' default = list(teal_transform_module(...)), # applied to all outputs +#' box_plot = list(teal_transform_module(...)), # applied only to `box_plot` output +#' density_plot = list(teal_transform_module(...)) # applied only to `density_plot` output +#' cumulative_plot = list(teal_transform_module(...)) # applied only to `cumulative_plot` output +#' table = list(teal_transform_module(...)) # applied only to `table` output +#' ) +#' ) +#' ``` +#' #' For additional details and examples of decorators, refer to the vignette #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. #' diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 550473e4a..253f94a8c 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -97,9 +97,9 @@ See code snippet below: ..., # arguments for module decorators = list( default = list(teal_transform_module(...)), # applied to all outputs - plot = list(teal_transform_module(...)), # applied only to plot output (histogram plot) - test_table = list(teal_transform_module(...)) # applied only to test_table - summary_table = list(teal_transform_module(...)) # applied only to summary_table + plot = list(teal_transform_module(...)), # applied only to `plot` output (histogram plot) + test_table = list(teal_transform_module(...)) # applied only to `test_table` output + summary_table = list(teal_transform_module(...)) # applied only to `summary_table` output ) ) }\if{html}{\out{}} diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index 63f36d576..0fafb4e4c 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -73,6 +73,23 @@ This module generates the following objects, which can be modified in place usin \item \code{table} (\code{\link[DT:datatable]{DT::datatable()}}) } +Decorators can be applied to all outputs or only to specific objects using a +named list of \code{teal_transform_module} objects. +The \code{"default"} name is reserved for decorators that are applied to all outputs. +See code snippet below: + +\if{html}{\out{
}}\preformatted{tm_missing_data( + ..., # arguments for module + decorators = list( + default = list(teal_transform_module(...)), # applied to all outputs + summary_plot = list(teal_transform_module(...)), # applied only to `summary_plot` output + combination_plot = list(teal_transform_module(...)) # applied only to `combination_plot` output + by_subject_plot = list(teal_transform_module(...)) # applied only to `by_subject_plot` output + table = list(teal_transform_module(...)) # applied only to `table` output + ) +) +}\if{html}{\out{
}} + For additional details and examples of decorators, refer to the vignette \code{vignette("decorate-modules-output", package = "teal")} or the \code{\link[=teal_transform_module]{teal_transform_module()}} documentation. } diff --git a/man/tm_outliers.Rd b/man/tm_outliers.Rd index 9133be55c..be0716e59 100644 --- a/man/tm_outliers.Rd +++ b/man/tm_outliers.Rd @@ -73,6 +73,23 @@ This module generates the following objects, which can be modified in place usin \item \code{table} (\code{\link[DT:datatable]{DT::datatable()}}) } +Decorators can be applied to all outputs or only to specific objects using a +named list of \code{teal_transform_module} objects. +The \code{"default"} name is reserved for decorators that are applied to all outputs. +See code snippet below: + +\if{html}{\out{
}}\preformatted{tm_outliers( + ..., # arguments for module + decorators = list( + default = list(teal_transform_module(...)), # applied to all outputs + box_plot = list(teal_transform_module(...)), # applied only to `box_plot` output + density_plot = list(teal_transform_module(...)) # applied only to `density_plot` output + cumulative_plot = list(teal_transform_module(...)) # applied only to `cumulative_plot` output + table = list(teal_transform_module(...)) # applied only to `table` output + ) +) +}\if{html}{\out{
}} + For additional details and examples of decorators, refer to the vignette \code{vignette("decorate-modules-output", package = "teal")} or the \code{\link[=teal_transform_module]{teal_transform_module()}} documentation. } From 943c260f278a385e159ca8624be7f327e919ef84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:29:46 +0000 Subject: [PATCH 19/31] fix: use plot/table with only 1 output, instead of only relying on default --- R/tm_a_pca.R | 8 ++++---- R/tm_data_table.R | 6 +++--- R/tm_g_association.R | 6 +++--- R/tm_g_bivariate.R | 6 +++--- R/tm_g_response.R | 6 +++--- R/tm_g_scatterplot.R | 6 +++--- R/tm_g_scatterplotmatrix.R | 6 +++--- R/tm_t_crosstable.R | 8 ++++---- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 50548b063..ac31aa38b 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -165,8 +165,8 @@ tm_a_pca <- function(label = "Principal Component Analysis", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "plot") + assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions # Make UI args @@ -241,7 +241,7 @@ ui_a_pca <- function(id, ...) { choices = args$plot_choices, selected = args$plot_choices[1] ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)) + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)) ), teal.widgets::panel_item( title = "Pre-processing", @@ -979,7 +979,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl decorated_output_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("default", decorators), + decorators = subset_decorators("plot", decorators), expr = print(plot) ) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 737b258f6..0556ba0f8 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -131,8 +131,8 @@ tm_data_table <- function(label = "Data Table", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "table") + assert_decorators(decorators, null.ok = TRUE, "table") # End of assertions ans <- module( @@ -297,7 +297,7 @@ ui_data_table <- function(id, tagList( teal.widgets::get_dt_rows(ns("data_table"), ns("dt_rows")), fluidRow( - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", decorators)), teal.widgets::optionalSelectInput( ns("variables"), "Select variables:", diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 822e74486..578438af3 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -176,8 +176,8 @@ tm_g_association <- function(label = "Association", checkmate::assert_list(ggplot2_args, types = "ggplot2_args") checkmate::assert_subset(names(ggplot2_args), c("default", plot_choices)) - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "plot") + assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions @@ -249,7 +249,7 @@ ui_tm_g_association <- function(id, ...) { "Log transformed", value = FALSE ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 5e0dc5355..cfcea7c2e 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -276,8 +276,8 @@ tm_g_bivariate <- function(label = "Bivariate Plots", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "plot") + assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions # Make UI args @@ -351,7 +351,7 @@ ui_g_bivariate <- function(id, ...) { justified = TRUE ) ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), if (!is.null(args$row_facet) || !is.null(args$col_facet)) { tags$div( class = "data-extract-box", diff --git a/R/tm_g_response.R b/R/tm_g_response.R index 229b257f0..d94d92f2e 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -201,8 +201,8 @@ tm_g_response <- function(label = "Response Plot", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "plot") + assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions # Make UI args @@ -286,7 +286,7 @@ ui_g_response <- function(id, ...) { selected = ifelse(args$freq, "frequency", "density"), justified = TRUE ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 296a05af9..c4a27960d 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -308,8 +308,8 @@ tm_g_scatterplot <- function(label = "Scatterplot", checkmate::assert_scalar(table_dec) checkmate::assert_class(ggplot2_args, "ggplot2_args") - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "plot") + assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions @@ -433,7 +433,7 @@ ui_g_scatterplot <- function(id, ...) { is_single_dataset = is_single_dataset_value ) }, - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 0f2c4866e..49ad4b9d5 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -203,8 +203,8 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "plot") + assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions # Make UI args @@ -251,7 +251,7 @@ ui_g_scatterplotmatrix <- function(id, ...) { is_single_dataset = is_single_dataset_value ), tags$hr(), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 2f7ce32bd..157b4ec63 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -168,8 +168,8 @@ tm_t_crosstable <- function(label = "Cross Table", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_class(basic_table_args, classes = "basic_table_args") - decorators <- normalize_decorators(decorators) - assert_decorators(decorators, null.ok = TRUE) + decorators <- normalize_decorators(decorators, "plot") + assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions # Make UI args @@ -236,7 +236,7 @@ ui_t_crosstable <- function(id, x, y, show_percentage, show_total, pre_output, p checkboxInput(ns("show_total"), "Show total column", value = show_total) ) ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("default", args$decorators)) + ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)) ), forms = tagList( teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") @@ -412,7 +412,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, decorated_output_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("default", decorators), + decorators = subset_decorators("plot", decorators), expr = table ) From 039c37a3923b4e0a4ead8f52f3259ec577414cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:32:05 +0000 Subject: [PATCH 20/31] docs: generate man page --- man/normalize_decorators.Rd | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 man/normalize_decorators.Rd diff --git a/man/normalize_decorators.Rd b/man/normalize_decorators.Rd new file mode 100644 index 000000000..5e4f68f8c --- /dev/null +++ b/man/normalize_decorators.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{normalize_decorators} +\alias{normalize_decorators} +\title{Convert flat list of \code{teal_transform_module} to named lists} +\usage{ +normalize_decorators(decorators, available_decorators = NULL) +} +\arguments{ +\item{decorators}{(list of \code{teal_transformodules}) to normalize.} + +\item{available_decorators}{(\code{character}) a character vector of available decorator names. +When \code{NULL} it assumes that all decorators should be applied, which can be used +when module only has 1 object.} +} +\value{ +A named list of lists with \code{teal_transform_module} objects. +} +\description{ +Convert flat list of \code{teal_transform_module} to named lists +} +\keyword{internal} From 337c2af2512bea20f5abd6dc2547559208bf22a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:34:06 +0000 Subject: [PATCH 21/31] feat: tm_a_pca plot object split in 4 --- R/tm_a_pca.R | 120 ++++++++++++++++++++++++++++++++++++------------ R/tm_outliers.R | 28 ++++++----- man/tm_a_pca.Rd | 22 ++++++++- 3 files changed, 125 insertions(+), 45 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index ac31aa38b..fea55e7cb 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -21,12 +21,32 @@ #' @section Decorating `tm_a_pca`: #' #' This module generates the following objects, which can be modified in place using decorators: -#' - `plot` (`ggplot2`) +#' - `elbow_plot` (`ggplot2`) +#' - `circle_plot` (`ggplot2`) +#' - `biplot` (`ggplot2`) +#' - `eigenvector_plot` (`ggplot2`) +#' +#' Decorators can be applied to all outputs or only to specific objects using a +#' named list of `teal_transform_module` objects. +#' The `"default"` name is reserved for decorators that are applied to all outputs. +#' See code snippet below: +#' +#' ``` +#' tm_a_pca( +#' ..., # arguments for module +#' decorators = list( +#' default = list(teal_transform_module(...)), # applied to all outputs +#' elbow_plot = list(teal_transform_module(...)), # applied only to `elbow_plot` output +#' circle_plot = list(teal_transform_module(...)) # applied only to `circle_plot` output +#' biplot = list(teal_transform_module(...)) # applied only to `biplot` output +#' eigenvector_plot = list(teal_transform_module(...)) # applied only to `eigenvector_plot` output +#' ) +#' ) +#' ``` #' #' For additional details and examples of decorators, refer to the vignette #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. #' -#' #' @examplesShinylive #' library(teal.modules.general) #' interactive <- function() TRUE @@ -165,8 +185,9 @@ tm_a_pca <- function(label = "Principal Component Analysis", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators, "plot") - assert_decorators(decorators, null.ok = TRUE, "plot") + available_decorators <- c("elbow_plot", "circle_plot", "biplot", "eigenvector_plot") + decorators <- normalize_decorators(decorators, available_decorators) + assert_decorators(decorators, null.ok = TRUE, available_decorators) # End of assertions # Make UI args @@ -241,7 +262,22 @@ ui_a_pca <- function(id, ...) { choices = args$plot_choices, selected = args$plot_choices[1] ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)) + conditionalPanel( + condition = sprintf("input['%s'] == 'Elbow plot'", ns("plot_type")), + ui_decorate_teal_data(ns("d_elbow_plot"), decorators = subset_decorators("elbow_plot", args$decorators)) + ), + conditionalPanel( + condition = sprintf("input['%s'] == 'Circle plot'", ns("plot_type")), + ui_decorate_teal_data(ns("d_circle_plot"), decorators = subset_decorators("circle_plot", args$decorators)) + ), + conditionalPanel( + condition = sprintf("input['%s'] == 'Biplot'", ns("plot_type")), + ui_decorate_teal_data(ns("d_biplot"), decorators = subset_decorators("biplot", args$decorators)) + ), + conditionalPanel( + condition = sprintf("input['%s'] == 'Eigenvector plot'", ns("plot_type")), + ui_decorate_teal_data(ns("d_eigenvector_plot"), decorators = subset_decorators("eigenvector_plot", args$decorators)) + ) ), teal.widgets::panel_item( title = "Pre-processing", @@ -566,7 +602,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl ) cols <- c(getOption("ggplot2.discrete.colour"), c("lightblue", "darkred", "black"))[1:3] - plot <- ggplot(mapping = aes_string(x = "component", y = "value")) + + elbow_plot <- ggplot(mapping = aes_string(x = "component", y = "value")) + geom_bar( aes(fill = "Single variance"), data = dplyr::filter(elb_dat, metric == "Proportion of Variance"), @@ -643,7 +679,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl y = sin(seq(0, 2 * pi, length.out = 100)) ) - plot <- ggplot(pca_rot) + + circle_plot <- ggplot(pca_rot) + geom_point(aes_string(x = x_axis, y = y_axis)) + geom_label( aes_string(x = x_axis, y = y_axis, label = "label"), @@ -875,7 +911,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl qenv, substitute( expr = { - plot <- plot_call + biplot <- plot_call }, env = list( plot_call = Reduce(function(x, y) call("+", x, y), pca_plot_biplot_expr) @@ -884,8 +920,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl ) } - # plot pc_var ---- - plot_pc_var <- function(base_q) { + # plot eigenvector_plot ---- + plot_eigenvector <- function(base_q) { pc <- input$pc ggtheme <- input$ggtheme @@ -951,7 +987,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl expr = { pca_rot <- pca$rotation[, pc, drop = FALSE] %>% dplyr::as_tibble(rownames = "Variable") - plot <- plot_call + eigenvector_plot <- plot_call }, env = list( pc = pc, @@ -961,29 +997,55 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl ) } - # plot final ---- - output_q <- reactive({ - req(computation()) - teal::validate_inputs(iv_r()) - teal::validate_inputs(iv_extra, header = "Plot settings are required") + # qenvs --- + output_q <- lapply( + list( + elbow_plot = plot_elbow, + circle_plot = plot_circle, + biplot = plot_biplot, + eigenvector_plot = plot_eigenvector + ), + function(fun) { + reactive({ + req(computation()) + teal::validate_inputs(iv_r()) + teal::validate_inputs(iv_extra, header = "Plot settings are required") + fun(computation()) + }) + } + ) - switch(input$plot_type, - "Elbow plot" = plot_elbow(computation()), - "Circle plot" = plot_circle(computation()), - "Biplot" = plot_biplot(computation()), - "Eigenvector plot" = plot_pc_var(computation()), + decorated_q <- mapply( + function(obj_name, q) { + srv_decorate_teal_data( + id = sprintf("d_%s", obj_name), + data = q, + decorators = subset_decorators(obj_name, decorators), + expr = reactive({ + substitute(print(.plot), env = list(.plot = as.name(obj_name))) + }), + expr_is_reactive = TRUE + ) + }, + names(output_q), + output_q + ) + + # plot final ---- + decorated_output_q <- reactive({ + switch(req(input$plot_type), + "Elbow plot" = decorated_q$elbow_plot(), + "Circle plot" = decorated_q$circle_plot(), + "Biplot" = decorated_q$biplot(), + "Eigenvector plot" = decorated_q$eigenvector_plot(), stop("Unknown plot") ) }) - decorated_output_q <- srv_decorate_teal_data( - id = "decorator", - data = output_q, - decorators = subset_decorators("plot", decorators), - expr = print(plot) - ) - - plot_r <- reactive(req(decorated_output_q())[["plot"]]) + plot_r <- reactive({ + plot_name <- gsub(" ", "_", tolower(req(input$plot_type))) + req(decorated_output_q())[[plot_name]] + }) pws <- teal.widgets::plot_with_settings_srv( id = "pca_plot", diff --git a/R/tm_outliers.R b/R/tm_outliers.R index d9d8d6849..c8073b996 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -996,27 +996,25 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) }) - post_expr <- reactive({ - substitute( - expr = { - columns_index <- union( - setdiff(names(ANL_OUTLIER), c("is_outlier_selected", "order")), - table_columns - ) - ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] - print(.plot) - }, - env = list(table_columns = input$table_ui_columns, .plot = as.name(current_tab_r())) - ) - }) - decorated_q <- mapply( function(obj_name, q) { srv_decorate_teal_data( id = sprintf("d_%s", obj_name), data = q, decorators = subset_decorators(obj_name, decorators), - expr = post_expr, + expr = reactive({ + substitute( + expr = { + columns_index <- union( + setdiff(names(ANL_OUTLIER), c("is_outlier_selected", "order")), + table_columns + ) + ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] + print(.plot) + }, + env = list(table_columns = input$table_ui_columns, .plot = as.name(obj_name)) + ) + }), expr_is_reactive = TRUE ) }, diff --git a/man/tm_a_pca.Rd b/man/tm_a_pca.Rd index 47b48deea..54de83bdb 100644 --- a/man/tm_a_pca.Rd +++ b/man/tm_a_pca.Rd @@ -92,9 +92,29 @@ font size, through UI inputs. This module generates the following objects, which can be modified in place using decorators: \itemize{ -\item \code{plot} (\code{ggplot2}) +\item \code{elbow_plot} (\code{ggplot2}) +\item \code{circle_plot} (\code{ggplot2}) +\item \code{biplot} (\code{ggplot2}) +\item \code{eigenvector_plot} (\code{ggplot2}) } +Decorators can be applied to all outputs or only to specific objects using a +named list of \code{teal_transform_module} objects. +The \code{"default"} name is reserved for decorators that are applied to all outputs. +See code snippet below: + +\if{html}{\out{
}}\preformatted{tm_a_pca( + ..., # arguments for module + decorators = list( + default = list(teal_transform_module(...)), # applied to all outputs + elbow_plot = list(teal_transform_module(...)), # applied only to `elbow_plot` output + circle_plot = list(teal_transform_module(...)) # applied only to `circle_plot` output + biplot = list(teal_transform_module(...)) # applied only to `biplot` output + eigenvector_plot = list(teal_transform_module(...)) # applied only to `eigenvector_plot` output + ) +) +}\if{html}{\out{
}} + For additional details and examples of decorators, refer to the vignette \code{vignette("decorate-modules-output", package = "teal")} or the \code{\link[=teal_transform_module]{teal_transform_module()}} documentation. } From f9c1d7b7ad31ff08ff11485f15a16161bb72caf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 20:02:22 +0000 Subject: [PATCH 22/31] chore: fix linter errors --- R/tm_a_pca.R | 20 ++++++++++++++++---- R/tm_outliers.R | 15 ++++++++++++--- R/utils.R | 2 +- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index fea55e7cb..33173203f 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -264,19 +264,31 @@ ui_a_pca <- function(id, ...) { ), conditionalPanel( condition = sprintf("input['%s'] == 'Elbow plot'", ns("plot_type")), - ui_decorate_teal_data(ns("d_elbow_plot"), decorators = subset_decorators("elbow_plot", args$decorators)) + ui_decorate_teal_data( + ns("d_elbow_plot"), + decorators = subset_decorators("elbow_plot", args$decorators) + ) ), conditionalPanel( condition = sprintf("input['%s'] == 'Circle plot'", ns("plot_type")), - ui_decorate_teal_data(ns("d_circle_plot"), decorators = subset_decorators("circle_plot", args$decorators)) + ui_decorate_teal_data( + ns("d_circle_plot"), + decorators = subset_decorators("circle_plot", args$decorators) + ) ), conditionalPanel( condition = sprintf("input['%s'] == 'Biplot'", ns("plot_type")), - ui_decorate_teal_data(ns("d_biplot"), decorators = subset_decorators("biplot", args$decorators)) + ui_decorate_teal_data( + ns("d_biplot"), + decorators = subset_decorators("biplot", args$decorators) + ) ), conditionalPanel( condition = sprintf("input['%s'] == 'Eigenvector plot'", ns("plot_type")), - ui_decorate_teal_data(ns("d_eigenvector_plot"), decorators = subset_decorators("eigenvector_plot", args$decorators)) + ui_decorate_teal_data( + ns("d_eigenvector_plot"), + decorators = subset_decorators("eigenvector_plot", args$decorators) + ) ) ), teal.widgets::panel_item( diff --git a/R/tm_outliers.R b/R/tm_outliers.R index c8073b996..e33215e72 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -343,15 +343,24 @@ ui_outliers <- function(id, ...) { ), conditionalPanel( condition = paste0("input['", ns("tabs"), "'] == 'Boxplot'"), - ui_decorate_teal_data(ns("d_box_plot"), decorators = subset_decorators("box_plot", args$decorators)) + ui_decorate_teal_data( + ns("d_box_plot"), + decorators = subset_decorators("box_plot", args$decorators) + ) ), conditionalPanel( condition = paste0("input['", ns("tabs"), "'] == 'Density Plot'"), - ui_decorate_teal_data(ns("d_density_plot"), decorators = subset_decorators("density_plot", args$decorators)) + ui_decorate_teal_data( + ns("d_density_plot"), + decorators = subset_decorators("density_plot", args$decorators) + ) ), conditionalPanel( condition = paste0("input['", ns("tabs"), "'] == 'Cumulative Distribution Plot'"), - ui_decorate_teal_data(ns("d_cumulative_plot"), decorators = subset_decorators("cumulative_plot", args$decorators)) + ui_decorate_teal_data( + ns("d_cumulative_plot"), + decorators = subset_decorators("cumulative_plot", args$decorators) + ) ), ui_decorate_teal_data(ns("d_table"), decorators = subset_decorators("table", args$decorators)), teal.widgets::panel_item( diff --git a/R/utils.R b/R/utils.R index 6360e16a6..f74353685 100644 --- a/R/utils.R +++ b/R/utils.R @@ -328,7 +328,7 @@ ui_decorate_teal_data <- function(id, decorators, ...) { #' Internal function to check if decorators is a valid object #' @noRd -check_decorators <- function(x, names = NULL, null.ok = FALSE) { +check_decorators <- function(x, names = NULL, null.ok = FALSE) { # nolint: object_name. checkmate::qassert(null.ok, "B1") check_message <- checkmate::check_list( From 9ec43816040759dad56bcc4c180353a52a32071e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 20:17:11 +0000 Subject: [PATCH 23/31] feat: tm_g_distribution --- R/tm_g_distribution.R | 138 ++++++++++++++++++++++++++---------------- 1 file changed, 86 insertions(+), 52 deletions(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index db939580c..856c9d451 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -30,9 +30,10 @@ #' @section Decorating `tm_outliers`: #' #' This module generates the following objects, which can be modified in place using decorators:: -#' - `plot` (`ggplot2`) -#' - `test_table` (`data.frame`) +#' - `histogram_plot` (`ggplot2`) +#' - `qq_plot` (`data.frame`) #' - `summary_table` (`data.frame`) +#' - `test_table` (`data.frame`) #' #' Decorators can be applied to all outputs or only to specific objects using a #' named list of `teal_transform_module` objects. @@ -44,9 +45,10 @@ #' ..., # arguments for module #' decorators = list( #' default = list(teal_transform_module(...)), # applied to all outputs -#' plot = list(teal_transform_module(...)), # applied only to `plot` output (histogram plot) -#' test_table = list(teal_transform_module(...)) # applied only to `test_table` output +#' histogram_plot = list(teal_transform_module(...)), # applied only to `histogram_plot` output (histogram plot) +#' qq_plot = list(teal_transform_module(...)) # applied only to `qq_plot` output #' summary_table = list(teal_transform_module(...)) # applied only to `summary_table` output +#' test_table = list(teal_transform_module(...)) # applied only to `test_table` output #' ) #' ) #' ``` @@ -201,7 +203,7 @@ tm_g_distribution <- function(label = "Distribution Module", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - available_decorators <- c("plot", "test_table", "summary_table") + available_decorators <- c("histogram_plot", "qq_plot", "test_table", "summary_table") decorators <- normalize_decorators(decorators, available_decorators) assert_decorators(decorators, null.ok = TRUE, names = available_decorators) @@ -300,7 +302,10 @@ ui_distribution <- function(id, ...) { inline = TRUE ), checkboxInput(ns("add_dens"), label = "Overlay Density", value = TRUE), - ui_transform_teal_data(ns("d_dist"), transformators = args$decorators), + ui_decorate_teal_data( + ns("d_density"), + decorators = subset_decorators("histogram_plot", args$decorators) + ), collapsed = FALSE ) ), @@ -309,10 +314,21 @@ ui_distribution <- function(id, ...) { teal.widgets::panel_item( "QQ Plot", checkboxInput(ns("qq_line"), label = "Add diagonal line(s)", TRUE), - ui_transform_teal_data(ns("d_qq"), transformators = args$decorators), + ui_decorate_teal_data( + ns("d_qq"), + decorators = subset_decorators("qq_plot", args$decorators) + ), collapsed = FALSE ) ), + ui_decorate_teal_data( + ns("d_summary"), + decorators = subset_decorators("summary_table", args$decorators) + ), + ui_decorate_teal_data( + ns("d_test"), + decorators = subset_decorators("test_table", args$decorators) + ), conditionalPanel( condition = paste0("input['", ns("main_type"), "'] == 'Density'"), teal.widgets::panel_item( @@ -697,12 +713,12 @@ srv_distribution <- function(id, ) } - if (length(s_var) == 0 && length(g_var) == 0) { - qenv <- teal.code::eval_code( + qenv <- if (length(s_var) == 0 && length(g_var) == 0) { + teal.code::eval_code( qenv, substitute( expr = { - summary_table <- ANL %>% + summary_table_data <- ANL %>% dplyr::summarise( min = round(min(dist_var_name, na.rm = TRUE), roundn), median = round(stats::median(dist_var_name, na.rm = TRUE), roundn), @@ -719,12 +735,12 @@ srv_distribution <- function(id, ) ) } else { - qenv <- teal.code::eval_code( + teal.code::eval_code( qenv, substitute( expr = { strata_vars <- strata_vars_raw - summary_table <- ANL %>% + summary_table_data <- ANL %>% dplyr::group_by_at(dplyr::vars(dplyr::any_of(strata_vars))) %>% dplyr::summarise( min = round(min(dist_var_name, na.rm = TRUE), roundn), @@ -734,7 +750,6 @@ srv_distribution <- function(id, sd = round(stats::sd(dist_var_name, na.rm = TRUE), roundn), count = dplyr::n() ) - summary_table # used to display table when running show-r-code code }, env = list( dist_var_name = dist_var_name, @@ -744,6 +759,20 @@ srv_distribution <- function(id, ) ) } + if (iv_r()$is_valid()) { + within(qenv, { + summary_table <- DT::datatable( + summary_table_data, + options = list( + autoWidth = TRUE, + columnDefs = list(list(width = "200px", targets = "_all")) + ), + rownames = FALSE + ) + }) + } else { + within(qenv, summary_table <- NULL) + } }) # distplot qenv ---- @@ -933,7 +962,7 @@ srv_distribution <- function(id, teal.code::eval_code( qenv, substitute( - expr = plot <- plot_call, + expr = histogram_plot <- plot_call, env = list(plot_call = Reduce(function(x, y) call("+", x, y), c(plot_call, parsed_ggplot2_args))) ) ) @@ -1062,7 +1091,7 @@ srv_distribution <- function(id, teal.code::eval_code( qenv, substitute( - expr = plot <- plot_call, + expr = qq_plot <- plot_call, env = list(plot_call = Reduce(function(x, y) call("+", x, y), c(plot_call, parsed_ggplot2_args))) ) ) @@ -1211,7 +1240,7 @@ srv_distribution <- function(id, qenv, substitute( expr = { - test_table <- ANL %>% + test_table_data <- ANL %>% dplyr::select(dist_var) %>% with(., broom::glance(do.call(test, args))) %>% dplyr::mutate_if(is.numeric, round, 3) @@ -1224,7 +1253,7 @@ srv_distribution <- function(id, qenv, substitute( expr = { - test_table <- ANL %>% + test_table_data <- ANL %>% dplyr::select(dist_var, s_var, g_var) %>% dplyr::group_by_at(dplyr::vars(dplyr::any_of(groups))) %>% dplyr::do(tests = broom::glance(do.call(test, args))) %>% @@ -1235,9 +1264,6 @@ srv_distribution <- function(id, ) ) } - qenv %>% - # used to display table when running show-r-code code - teal.code::eval_code(quote(test_table)) } ) @@ -1247,32 +1273,39 @@ srv_distribution <- function(id, # wrapped in if since could lead into validate error - we do want to continue test_q_out <- try(test_q(), silent = TRUE) if (!inherits(test_q_out, c("try-error", "error"))) { - c(common_q(), test_q_out) + c( + common_q(), + within(test_q_out, { + test_table <- DT::datatable( + test_table_data, + options = list(scrollX = TRUE), + rownames = FALSE + ) + }) + ) } else { - common_q() + within(common_q(), test_table <- NULL) } }) output_dist_q <- reactive(c(output_common_q(), req(dist_q()))) output_qq_q <- reactive(c(output_common_q(), req(qq_q()))) - decorated_output_dist_q_no_print <- srv_transform_teal_data( - "d_dist", + decorated_output_dist_q <- srv_decorate_teal_data( + "d_density", data = output_dist_q, - transformators = decorators + decorators = subset_decorators("histogram_plot", decorators), + expr = print(histogram_plot) ) - decorated_output_dist_q <- reactive(within(req(decorated_output_dist_q_no_print()), expr = print(plot))) - - decorated_output_qq_q_no_print <- srv_transform_teal_data( + decorated_output_qq_q <- srv_decorate_teal_data( "d_qq", data = output_qq_q, - transformators = decorators + decorators = subset_decorators("qq_plot", decorators), + expr = print(qq_plot) ) - decorated_output_qq_q <- reactive(within(req(decorated_output_qq_q_no_print()), expr = print(plot))) - - decorated_output_q <- reactive({ + decorated_output_q_base <- reactive({ tab <- req(input$tabs) # tab is NULL upon app launch, hence will crash without this statement if (tab == "Histogram") { decorated_output_dist_q() @@ -1281,30 +1314,33 @@ srv_distribution <- function(id, } }) - dist_r <- reactive({ - req(output_dist_q()) # Ensure original errors are displayed - decorated_output_dist_q()[["plot"]] - }) - - qq_r <- reactive({ - req(output_qq_q()) # Ensure original errors are displayed - decorated_output_qq_q()[["plot"]] - }) + decorated_output_q_summary <- srv_decorate_teal_data( + "d_summary", + data = decorated_output_q_base, + decorators = subset_decorators("summary_table", decorators), + expr = summary_table + ) - output$summary_table <- DT::renderDataTable( - expr = if (iv_r()$is_valid()) decorated_output_dist_q()[["summary_table"]] else NULL, - options = list( - autoWidth = TRUE, - columnDefs = list(list(width = "200px", targets = "_all")) - ), - rownames = FALSE + decorated_output_q_test <- srv_decorate_teal_data( + "d_test", + data = decorated_output_q_summary, + decorators = subset_decorators("test_table", decorators), + expr = test_table ) + decorated_output_q <- decorated_output_q_test + + dist_r <- reactive(req(decorated_output_dist_q())[["histogram_plot"]]) + + qq_r <- reactive(req(decorated_output_qq_q())[["qq_plot"]]) + + output$summary_table <- DT::renderDataTable(expr = decorated_output_q()[["summary_table"]]) + tests_r <- reactive({ req(iv_r()$is_valid()) teal::validate_inputs(iv_r_dist()) req(test_q()) # Ensure original errors are displayed - decorated_output_dist_q()[["test_table"]] + decorated_output_q()[["test_table"]] }) pws1 <- teal.widgets::plot_with_settings_srv( @@ -1324,9 +1360,7 @@ srv_distribution <- function(id, ) output$t_stats <- DT::renderDataTable( - expr = tests_r(), - options = list(scrollX = TRUE), - rownames = FALSE + expr = tests_r() ) teal.widgets::verbatim_popup_srv( From 34bc4cd080227dea3ba45b78a0e00c9cebe7d30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 27 Nov 2024 20:32:32 +0000 Subject: [PATCH 24/31] fix: normalize decorators --- R/tm_a_pca.R | 2 +- R/tm_data_table.R | 2 +- R/tm_g_association.R | 2 +- R/tm_g_bivariate.R | 2 +- R/tm_g_distribution.R | 2 +- R/tm_g_response.R | 2 +- R/tm_g_scatterplot.R | 2 +- R/tm_g_scatterplotmatrix.R | 2 +- R/tm_missing_data.R | 2 +- R/tm_outliers.R | 2 +- R/tm_t_crosstable.R | 2 +- R/utils.R | 10 ++++------ 12 files changed, 15 insertions(+), 17 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 33173203f..bfcba7a81 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -186,7 +186,7 @@ tm_a_pca <- function(label = "Principal Component Analysis", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) available_decorators <- c("elbow_plot", "circle_plot", "biplot", "eigenvector_plot") - decorators <- normalize_decorators(decorators, available_decorators) + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, available_decorators) # End of assertions diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 0556ba0f8..b7c94d308 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -131,7 +131,7 @@ tm_data_table <- function(label = "Data Table", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators, "table") + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, "table") # End of assertions diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 578438af3..3d42b991d 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -176,7 +176,7 @@ tm_g_association <- function(label = "Association", checkmate::assert_list(ggplot2_args, types = "ggplot2_args") checkmate::assert_subset(names(ggplot2_args), c("default", plot_choices)) - decorators <- normalize_decorators(decorators, "plot") + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index cfcea7c2e..53ce1015c 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -276,7 +276,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators, "plot") + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 856c9d451..f3ac6a425 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -204,7 +204,7 @@ tm_g_distribution <- function(label = "Distribution Module", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) available_decorators <- c("histogram_plot", "qq_plot", "test_table", "summary_table") - decorators <- normalize_decorators(decorators, available_decorators) + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions diff --git a/R/tm_g_response.R b/R/tm_g_response.R index d94d92f2e..c499db7f1 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -201,7 +201,7 @@ tm_g_response <- function(label = "Response Plot", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators, "plot") + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index c4a27960d..efa098bd9 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -308,7 +308,7 @@ tm_g_scatterplot <- function(label = "Scatterplot", checkmate::assert_scalar(table_dec) checkmate::assert_class(ggplot2_args, "ggplot2_args") - decorators <- normalize_decorators(decorators, "plot") + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 49ad4b9d5..102b07469 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -203,7 +203,7 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - decorators <- normalize_decorators(decorators, "plot") + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 33de73d09..c74ff01c3 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -153,7 +153,7 @@ tm_missing_data <- function(label = "Missing data", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) available_decorators <- c("summary_plot", "summary_plot", "combination_plot", "by_subject_plot", "summary_table") - decorators <- normalize_decorators(decorators, available_decorators) + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions diff --git a/R/tm_outliers.R b/R/tm_outliers.R index e33215e72..0d6a65e29 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -197,7 +197,7 @@ tm_outliers <- function(label = "Outliers Module", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) available_decorators <- c("box_plot", "density_plot", "cumulative_plot", "table") - decorators <- normalize_decorators(decorators, available_decorators) + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 157b4ec63..487392633 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -168,7 +168,7 @@ tm_t_crosstable <- function(label = "Cross Table", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_class(basic_table_args, classes = "basic_table_args") - decorators <- normalize_decorators(decorators, "plot") + decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, "plot") # End of assertions diff --git a/R/utils.R b/R/utils.R index f74353685..f589f8a0c 100644 --- a/R/utils.R +++ b/R/utils.R @@ -394,18 +394,16 @@ subset_decorators <- function(scope, decorators) { #' Convert flat list of `teal_transform_module` to named lists #' #' @param decorators (list of `teal_transformodules`) to normalize. -#' @param available_decorators (`character`) a character vector of available decorator names. -#' When `NULL` it assumes that all decorators should be applied, which can be used -#' when module only has 1 object. #' @return A named list of lists with `teal_transform_module` objects. #' @keywords internal -normalize_decorators <- function(decorators, available_decorators = NULL) { - available_decorators <- union("default", available_decorators) +normalize_decorators <- function(decorators) { if (checkmate::test_list(decorators, "teal_transform_module", null.ok = TRUE)) { - decorators <- if (checkmate::test_names(names(decorators), subset.of = available_decorators)) { + if (checkmate::test_names(names(decorators))) { lapply(decorators, list) } else { list(default = decorators) } + } else { + decorators } } From 6f02f6384c55fed667b8aa6436d4fa48a8a17140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Nov 2024 13:21:22 +0100 Subject: [PATCH 25/31] Update R/tm_g_distribution.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com> Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com> --- R/tm_g_distribution.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index f3ac6a425..021f54b61 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -45,7 +45,7 @@ #' ..., # arguments for module #' decorators = list( #' default = list(teal_transform_module(...)), # applied to all outputs -#' histogram_plot = list(teal_transform_module(...)), # applied only to `histogram_plot` output (histogram plot) +#' histogram_plot = list(teal_transform_module(...)), # applied only to `histogram_plot` output #' qq_plot = list(teal_transform_module(...)) # applied only to `qq_plot` output #' summary_table = list(teal_transform_module(...)) # applied only to `summary_table` output #' test_table = list(teal_transform_module(...)) # applied only to `test_table` output From 33614b7506b2812270b567ccfb71331744475ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Nov 2024 13:22:58 +0100 Subject: [PATCH 26/31] Update R/tm_g_distribution.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com> Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com> --- R/tm_g_distribution.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 021f54b61..7e08bfa3e 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -1321,15 +1321,13 @@ srv_distribution <- function(id, expr = summary_table ) - decorated_output_q_test <- srv_decorate_teal_data( + decorated_output_q <- srv_decorate_teal_data( "d_test", data = decorated_output_q_summary, decorators = subset_decorators("test_table", decorators), expr = test_table ) - decorated_output_q <- decorated_output_q_test - dist_r <- reactive(req(decorated_output_dist_q())[["histogram_plot"]]) qq_r <- reactive(req(decorated_output_qq_q())[["qq_plot"]]) From 64b61cfc706887cc627f127a5a91621a5e00dd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Nov 2024 13:23:31 +0100 Subject: [PATCH 27/31] Update R/tm_missing_data.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com> Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com> --- R/tm_missing_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index c74ff01c3..9c35c62be 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -152,7 +152,7 @@ tm_missing_data <- function(label = "Missing data", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - available_decorators <- c("summary_plot", "summary_plot", "combination_plot", "by_subject_plot", "summary_table") + available_decorators <- c("summary_plot", "combination_plot", "by_subject_plot", "summary_table") decorators <- normalize_decorators(decorators) assert_decorators(decorators, null.ok = TRUE, names = available_decorators) # End of assertions From 64ccbceaf3fb106cc9ea93038872f2f4427c18f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:38:40 +0000 Subject: [PATCH 28/31] chore: reorder parameters and rename function to be more R-like suggestion by @m7pr --- R/tm_a_pca.R | 10 +++++----- R/tm_data_table.R | 4 ++-- R/tm_g_association.R | 4 ++-- R/tm_g_bivariate.R | 4 ++-- R/tm_g_distribution.R | 16 ++++++++-------- R/tm_g_response.R | 4 ++-- R/tm_g_scatterplot.R | 4 ++-- R/tm_g_scatterplotmatrix.R | 4 ++-- R/tm_missing_data.R | 16 ++++++++-------- R/tm_outliers.R | 12 ++++++------ R/tm_t_crosstable.R | 4 ++-- R/utils.R | 4 ++-- man/normalize_decorators.Rd | 6 +----- ...subset_decorators.Rd => select_decorators.Rd} | 10 +++++----- man/tm_g_distribution.Rd | 10 ++++++---- 15 files changed, 55 insertions(+), 57 deletions(-) rename man/{subset_decorators.Rd => select_decorators.Rd} (86%) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index bfcba7a81..c6a7fb55e 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -266,28 +266,28 @@ ui_a_pca <- function(id, ...) { condition = sprintf("input['%s'] == 'Elbow plot'", ns("plot_type")), ui_decorate_teal_data( ns("d_elbow_plot"), - decorators = subset_decorators("elbow_plot", args$decorators) + decorators = select_decorators(args$decorators, "elbow_plot") ) ), conditionalPanel( condition = sprintf("input['%s'] == 'Circle plot'", ns("plot_type")), ui_decorate_teal_data( ns("d_circle_plot"), - decorators = subset_decorators("circle_plot", args$decorators) + decorators = select_decorators(args$decorators, "circle_plot") ) ), conditionalPanel( condition = sprintf("input['%s'] == 'Biplot'", ns("plot_type")), ui_decorate_teal_data( ns("d_biplot"), - decorators = subset_decorators("biplot", args$decorators) + decorators = select_decorators(args$decorators, "biplot") ) ), conditionalPanel( condition = sprintf("input['%s'] == 'Eigenvector plot'", ns("plot_type")), ui_decorate_teal_data( ns("d_eigenvector_plot"), - decorators = subset_decorators("eigenvector_plot", args$decorators) + decorators = select_decorators(args$decorators, "eigenvector_plot") ) ) ), @@ -1032,7 +1032,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl srv_decorate_teal_data( id = sprintf("d_%s", obj_name), data = q, - decorators = subset_decorators(obj_name, decorators), + decorators = select_decorators(decorators, obj_name), expr = reactive({ substitute(print(.plot), env = list(.plot = as.name(obj_name))) }), diff --git a/R/tm_data_table.R b/R/tm_data_table.R index b7c94d308..0adbcccdc 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -297,7 +297,7 @@ ui_data_table <- function(id, tagList( teal.widgets::get_dt_rows(ns("data_table"), ns("dt_rows")), fluidRow( - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("table", decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(decorators, "table")), teal.widgets::optionalSelectInput( ns("variables"), "Select variables:", @@ -369,7 +369,7 @@ srv_data_table <- function(id, decorated_data_table_data <- srv_decorate_teal_data( id = "decorator", data = data_table_data, - decorators = subset_decorators("table", decorators) + decorators = select_decorators(decorators, "table") ) output$data_table <- DT::renderDataTable(server = server_rendering, { diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 3d42b991d..9110cc182 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -249,7 +249,7 @@ ui_tm_g_association <- function(id, ...) { "Log transformed", value = FALSE ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(args$decorators, "plot")), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -504,7 +504,7 @@ srv_tm_g_association <- function(id, decorated_output_grob_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("plot", decorators), + decorators = select_decorators(decorators, "plot"), expr = { grid::grid.newpage() grid::grid.draw(plot) diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 53ce1015c..447a574d8 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -351,7 +351,7 @@ ui_g_bivariate <- function(id, ...) { justified = TRUE ) ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(args$decorators, "plot")), if (!is.null(args$row_facet) || !is.null(args$col_facet)) { tags$div( class = "data-extract-box", @@ -669,7 +669,7 @@ srv_g_bivariate <- function(id, decorated_output_q_facets <- srv_decorate_teal_data( "decorator", data = output_q, - decorators = subset_decorators("plot", decorators), + decorators = select_decorators(decorators, "plot"), expr = reactive({ ANL <- merged$anl_q_r()[["ANL"]] row_facet_name <- as.vector(merged$anl_input_r()$columns_source$row_facet) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 7e08bfa3e..099c2dcfd 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -304,7 +304,7 @@ ui_distribution <- function(id, ...) { checkboxInput(ns("add_dens"), label = "Overlay Density", value = TRUE), ui_decorate_teal_data( ns("d_density"), - decorators = subset_decorators("histogram_plot", args$decorators) + decorators = select_decorators(args$decorators, "histogram_plot") ), collapsed = FALSE ) @@ -316,18 +316,18 @@ ui_distribution <- function(id, ...) { checkboxInput(ns("qq_line"), label = "Add diagonal line(s)", TRUE), ui_decorate_teal_data( ns("d_qq"), - decorators = subset_decorators("qq_plot", args$decorators) + decorators = select_decorators(args$decorators, "qq_plot") ), collapsed = FALSE ) ), ui_decorate_teal_data( ns("d_summary"), - decorators = subset_decorators("summary_table", args$decorators) + decorators = select_decorators(args$decorators, "summary_table") ), ui_decorate_teal_data( ns("d_test"), - decorators = subset_decorators("test_table", args$decorators) + decorators = select_decorators(args$decorators, "test_table") ), conditionalPanel( condition = paste0("input['", ns("main_type"), "'] == 'Density'"), @@ -1294,14 +1294,14 @@ srv_distribution <- function(id, decorated_output_dist_q <- srv_decorate_teal_data( "d_density", data = output_dist_q, - decorators = subset_decorators("histogram_plot", decorators), + decorators = select_decorators(decorators, "histogram_plot"), expr = print(histogram_plot) ) decorated_output_qq_q <- srv_decorate_teal_data( "d_qq", data = output_qq_q, - decorators = subset_decorators("qq_plot", decorators), + decorators = select_decorators(decorators, "qq_plot"), expr = print(qq_plot) ) @@ -1317,14 +1317,14 @@ srv_distribution <- function(id, decorated_output_q_summary <- srv_decorate_teal_data( "d_summary", data = decorated_output_q_base, - decorators = subset_decorators("summary_table", decorators), + decorators = select_decorators(decorators, "summary_table"), expr = summary_table ) decorated_output_q <- srv_decorate_teal_data( "d_test", data = decorated_output_q_summary, - decorators = subset_decorators("test_table", decorators), + decorators = select_decorators(decorators, "test_table"), expr = test_table ) diff --git a/R/tm_g_response.R b/R/tm_g_response.R index c499db7f1..c765de9ea 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -286,7 +286,7 @@ ui_g_response <- function(id, ...) { selected = ifelse(args$freq, "frequency", "density"), justified = TRUE ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(args$decorators, "plot")), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -556,7 +556,7 @@ srv_g_response <- function(id, decorated_output_plot_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("plot", decorators), + decorators = select_decorators(decorators, "plot"), expr = print(plot) ) diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index efa098bd9..f87adb13d 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -433,7 +433,7 @@ ui_g_scatterplot <- function(id, ...) { is_single_dataset = is_single_dataset_value ) }, - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(args$decorators, "plot")), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -1011,7 +1011,7 @@ srv_g_scatterplot <- function(id, decorated_output_plot_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("plot", decorators), + decorators = select_decorators(decorators, "plot"), expr = print(plot) ) diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 102b07469..64942a0f2 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -251,7 +251,7 @@ ui_g_scatterplotmatrix <- function(id, ...) { is_single_dataset = is_single_dataset_value ), tags$hr(), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)), + ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(args$decorators, "plot")), teal.widgets::panel_group( teal.widgets::panel_item( title = "Plot settings", @@ -449,7 +449,7 @@ srv_g_scatterplotmatrix <- function(id, decorated_output_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("plot", decorators), + decorators = select_decorators(decorators, "plot"), expr = print(plot) ) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 9c35c62be..512c9e070 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -422,16 +422,16 @@ encoding_missing_data <- function(id, summary_per_patient = FALSE, ggtheme, data value = FALSE ) }, - ui_decorate_teal_data(ns("dec_summary_plot"), decorators = subset_decorators("summary_plot", decorators)) + ui_decorate_teal_data(ns("dec_summary_plot"), decorators = select_decorators(decorators, "summary_plot")) ), conditionalPanel( is_tab_active_js(ns("summary_type"), "Combinations"), uiOutput(ns("cutoff")), - ui_decorate_teal_data(ns("dec_combination_plot"), decorators = subset_decorators("combination_plot", decorators)) + ui_decorate_teal_data(ns("dec_combination_plot"), decorators = select_decorators(decorators, "combination_plot")) ), conditionalPanel( is_tab_active_js(ns("summary_type"), "Grouped by Subject"), - ui_decorate_teal_data(ns("dec_by_subject_plot"), decorators = subset_decorators("by_subject_plot", decorators)) + ui_decorate_teal_data(ns("dec_by_subject_plot"), decorators = select_decorators(decorators, "by_subject_plot")) ), conditionalPanel( is_tab_active_js(ns("summary_type"), "By Variable Levels"), @@ -444,7 +444,7 @@ encoding_missing_data <- function(id, summary_per_patient = FALSE, ggtheme, data selected = "counts", inline = TRUE ), - ui_decorate_teal_data(ns("dec_summary_table"), decorators = subset_decorators("summary_table", decorators)) + ui_decorate_teal_data(ns("dec_summary_table"), decorators = select_decorators(decorators, "summary_table")) ), teal.widgets::panel_item( title = "Plot settings", @@ -1262,7 +1262,7 @@ srv_missing_data <- function(id, decorated_summary_plot_q <- srv_decorate_teal_data( id = "dec_summary_plot", data = summary_plot_q, - decorators = subset_decorators("summary_plot", decorators), + decorators = select_decorators(decorators, "summary_plot"), expr = { grid::grid.newpage() grid::grid.draw(summary_plot) @@ -1272,7 +1272,7 @@ srv_missing_data <- function(id, decorated_combination_plot_q <- srv_decorate_teal_data( id = "dec_combination_plot", data = combination_plot_q, - decorators = subset_decorators("combination_plot", decorators), + decorators = select_decorators(decorators, "combination_plot"), expr = { grid::grid.newpage() grid::grid.draw(combination_plot) @@ -1282,14 +1282,14 @@ srv_missing_data <- function(id, decorated_summary_table_q <- srv_decorate_teal_data( id = "dec_summary_table", data = summary_table_q, - decorators = subset_decorators("summary_table", decorators), + decorators = select_decorators(decorators, "summary_table"), expr = table ) decorated_by_subject_plot_q <- srv_decorate_teal_data( id = "dec_by_subject_plot", data = by_subject_plot_q, - decorators = subset_decorators("by_subject_plot", decorators), + decorators = select_decorators(decorators, "by_subject_plot"), expr = print(by_subject_plot) ) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 0d6a65e29..55ba7ad23 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -345,24 +345,24 @@ ui_outliers <- function(id, ...) { condition = paste0("input['", ns("tabs"), "'] == 'Boxplot'"), ui_decorate_teal_data( ns("d_box_plot"), - decorators = subset_decorators("box_plot", args$decorators) + decorators = select_decorators(args$decorators, "box_plot") ) ), conditionalPanel( condition = paste0("input['", ns("tabs"), "'] == 'Density Plot'"), ui_decorate_teal_data( ns("d_density_plot"), - decorators = subset_decorators("density_plot", args$decorators) + decorators = select_decorators(args$decorators, "density_plot") ) ), conditionalPanel( condition = paste0("input['", ns("tabs"), "'] == 'Cumulative Distribution Plot'"), ui_decorate_teal_data( ns("d_cumulative_plot"), - decorators = subset_decorators("cumulative_plot", args$decorators) + decorators = select_decorators(args$decorators, "cumulative_plot") ) ), - ui_decorate_teal_data(ns("d_table"), decorators = subset_decorators("table", args$decorators)), + ui_decorate_teal_data(ns("d_table"), decorators = select_decorators(args$decorators, "table")), teal.widgets::panel_item( title = "Plot settings", selectInput( @@ -1010,7 +1010,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, srv_decorate_teal_data( id = sprintf("d_%s", obj_name), data = q, - decorators = subset_decorators(obj_name, decorators), + decorators = select_decorators(decorators, obj_name), expr = reactive({ substitute( expr = { @@ -1036,7 +1036,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, decorated_final_q <- srv_decorate_teal_data( "d_table", data = decorated_final_q_no_table, - decorators = subset_decorators("table", decorators), + decorators = select_decorators(decorators, "table"), expr = table ) diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 487392633..3043181a1 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -236,7 +236,7 @@ ui_t_crosstable <- function(id, x, y, show_percentage, show_total, pre_output, p checkboxInput(ns("show_total"), "Show total column", value = show_total) ) ), - ui_decorate_teal_data(ns("decorator"), decorators = subset_decorators("plot", args$decorators)) + ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(args$decorators, "plot")) ), forms = tagList( teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") @@ -412,7 +412,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, decorated_output_q <- srv_decorate_teal_data( id = "decorator", data = output_q, - decorators = subset_decorators("plot", decorators), + decorators = select_decorators(decorators, "plot"), expr = table ) diff --git a/R/utils.R b/R/utils.R index f589f8a0c..0bff5ba9f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -385,8 +385,8 @@ assert_decorators <- checkmate::makeAssertionFunction(check_decorators) #' @return A flat list with all decorators to include. #' It can be an empty list if none of the scope exists in `decorators` argument. #' @keywords internal -subset_decorators <- function(scope, decorators) { - checkmate::assert_character(scope) +select_decorators <- function(decorators, scope) { + checkmate::assert_character(scope, null.ok = TRUE) scope <- intersect(union("default", scope), names(decorators)) c(list(), unlist(decorators[scope], recursive = FALSE)) } diff --git a/man/normalize_decorators.Rd b/man/normalize_decorators.Rd index 5e4f68f8c..a58207f16 100644 --- a/man/normalize_decorators.Rd +++ b/man/normalize_decorators.Rd @@ -4,14 +4,10 @@ \alias{normalize_decorators} \title{Convert flat list of \code{teal_transform_module} to named lists} \usage{ -normalize_decorators(decorators, available_decorators = NULL) +normalize_decorators(decorators) } \arguments{ \item{decorators}{(list of \code{teal_transformodules}) to normalize.} - -\item{available_decorators}{(\code{character}) a character vector of available decorator names. -When \code{NULL} it assumes that all decorators should be applied, which can be used -when module only has 1 object.} } \value{ A named list of lists with \code{teal_transform_module} objects. diff --git a/man/subset_decorators.Rd b/man/select_decorators.Rd similarity index 86% rename from man/subset_decorators.Rd rename to man/select_decorators.Rd index 9b229dffe..2c7403dca 100644 --- a/man/subset_decorators.Rd +++ b/man/select_decorators.Rd @@ -1,15 +1,15 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils.R -\name{subset_decorators} -\alias{subset_decorators} +\name{select_decorators} +\alias{select_decorators} \title{Subset decorators based on the scope} \usage{ -subset_decorators(scope, decorators) +select_decorators(decorators, scope) } \arguments{ -\item{scope}{(\code{character}) a character vector of decorator names to include.} - \item{decorators}{(named \code{list}) of list decorators to subset.} + +\item{scope}{(\code{character}) a character vector of decorator names to include.} } \value{ A flat list with all decorators to include. diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 253f94a8c..5a0d9aee9 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -83,9 +83,10 @@ visually and statistically analyze the variable's distribution. This module generates the following objects, which can be modified in place using decorators:: \itemize{ -\item \code{plot} (\code{ggplot2}) -\item \code{test_table} (\code{data.frame}) +\item \code{histogram_plot} (\code{ggplot2}) +\item \code{qq_plot} (\code{data.frame}) \item \code{summary_table} (\code{data.frame}) +\item \code{test_table} (\code{data.frame}) } Decorators can be applied to all outputs or only to specific objects using a @@ -97,9 +98,10 @@ See code snippet below: ..., # arguments for module decorators = list( default = list(teal_transform_module(...)), # applied to all outputs - plot = list(teal_transform_module(...)), # applied only to `plot` output (histogram plot) - test_table = list(teal_transform_module(...)) # applied only to `test_table` output + histogram_plot = list(teal_transform_module(...)), # applied only to `histogram_plot` output (histogram plot) + qq_plot = list(teal_transform_module(...)) # applied only to `qq_plot` output summary_table = list(teal_transform_module(...)) # applied only to `summary_table` output + test_table = list(teal_transform_module(...)) # applied only to `test_table` output ) ) }\if{html}{\out{}} From 1c8d0d75ddf1796588dfc4b986a2d747927bc6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:41:05 +0000 Subject: [PATCH 29/31] chore: rename documentation from @m7pr --- R/tm_missing_data.R | 4 ++-- man/tm_g_distribution.Rd | 2 +- man/tm_missing_data.Rd | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 512c9e070..e968006cb 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -20,8 +20,8 @@ #' @section Decorating `tm_missing_data`: #' #' This module generates the following objects, which can be modified in place using decorators: -#' - `summary_plot` (`ggplot2 plot grob`) -#' - `combination_plot` (`ggplot2 plot grob`) +#' - `summary_plot` (`grob` created with [ggplot2::ggplotGrob()]) +#' - `combination_plot` (`grob` created with [ggplot2::ggplotGrob()]) #' - `by_subject_plot` (`ggplot2`) #' - `table` ([DT::datatable()]) #' diff --git a/man/tm_g_distribution.Rd b/man/tm_g_distribution.Rd index 5a0d9aee9..646644857 100644 --- a/man/tm_g_distribution.Rd +++ b/man/tm_g_distribution.Rd @@ -98,7 +98,7 @@ See code snippet below: ..., # arguments for module decorators = list( default = list(teal_transform_module(...)), # applied to all outputs - histogram_plot = list(teal_transform_module(...)), # applied only to `histogram_plot` output (histogram plot) + histogram_plot = list(teal_transform_module(...)), # applied only to `histogram_plot` output qq_plot = list(teal_transform_module(...)) # applied only to `qq_plot` output summary_table = list(teal_transform_module(...)) # applied only to `summary_table` output test_table = list(teal_transform_module(...)) # applied only to `test_table` output diff --git a/man/tm_missing_data.Rd b/man/tm_missing_data.Rd index 0fafb4e4c..d4d7e6cf9 100644 --- a/man/tm_missing_data.Rd +++ b/man/tm_missing_data.Rd @@ -67,8 +67,8 @@ adaptable for general data analysis purposes. This module generates the following objects, which can be modified in place using decorators: \itemize{ -\item \code{summary_plot} (\verb{ggplot2 plot grob}) -\item \code{combination_plot} (\verb{ggplot2 plot grob}) +\item \code{summary_plot} (\code{grob} created with \code{\link[ggplot2:ggplotGrob]{ggplot2::ggplotGrob()}}) +\item \code{combination_plot} (\code{grob} created with \code{\link[ggplot2:ggplotGrob]{ggplot2::ggplotGrob()}}) \item \code{by_subject_plot} (\code{ggplot2}) \item \code{table} (\code{\link[DT:datatable]{DT::datatable()}}) } From e4ad8a26d6a45dd6af2ced753e424d41a91c5fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:55:09 +0000 Subject: [PATCH 30/31] chore: remove unnecessary vars in favor of long roxygen2 line with code and nolint --- R/tm_a_regression.R | 12 +++--------- R/tm_missing_data.R | 8 +++----- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 9ccd3be16..4c5368243 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -37,7 +37,9 @@ #' It takes the form of `c(value, min, max)` and it is passed to the `value_min_max` #' argument in `teal.widgets::optionalSliderInputValMinMax`. #' -#' @param ggplot2_args `r roxygen_ggplot2_args_param(regression_names)` +# nolint start: line_length. +#' @param ggplot2_args `r roxygen_ggplot2_args_param("Response vs Regressor", "Residuals vs Fitted", "Scale-Location", "Cook's distance", "Residuals vs Leverage", "Cook's dist vs Leverage")` +# nolint end: line_length. #' @param decorators `r roxygen_decorators_param("tm_a_regression")` #' #' @inherit shared_params return @@ -1034,11 +1036,3 @@ srv_a_regression <- function(id, ### }) } - -regression_names <- c( - "Response vs Regressor", - "Residuals vs Fitted", - "Scale-Location", "Cook's distance", - "Residuals vs Leverage", - "Cook's dist vs Leverage" -) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index e968006cb..34f41d61c 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -10,9 +10,11 @@ #' @param parent_dataname (`character(1)`) Specifies the parent dataset name. Default is `ADSL` for `CDISC` data. #' If provided and exists, enables additional analysis "by subject". For non-`CDISC` data, this parameter can be #' ignored. +# nolint start: line_length. #' @param ggtheme (`character`) optional, specifies the default `ggplot2` theme for plots. Defaults to `classic`. +# nolint end: line_length. #' -#' @param ggplot2_args `r roxygen_ggplot2_args_param(missing_data_names)` +#' @param ggplot2_args `r roxygen_ggplot2_args_param("Summary Obs", "Summary Patients", "Combinations Main", "Combinations Hist", "By Subject")` #' @param decorators `r roxygen_decorators_param("tm_missing_data")` #' #' @inherit shared_params return @@ -1405,7 +1407,3 @@ srv_missing_data <- function(id, ### }) } - -missing_data_names <- c( - "Summary Obs", "Summary Patients", "Combinations Main", "Combinations Hist", "By Subject" -) From 4d10d2320e8eb38be0e76f0adeba9f75c6712f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:57:37 +0000 Subject: [PATCH 31/31] docs: add parameter documentation --- R/utils.R | 3 ++- man/srv_decorate_teal_data.Rd | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index 0bff5ba9f..556a977d5 100644 --- a/R/utils.R +++ b/R/utils.R @@ -283,7 +283,8 @@ assert_single_selection <- function(x, #' @param expr (`expression` or `reactive`) to evaluate on the output of the decoration. #' When an expression it must be inline code. See [within()] #' Default is `NULL` which won't evaluate any appending code. -#' @param expr_is_reactive () +#' @param expr_is_reactive (`logical(1)`) whether `expr` is a reactive expression +#' that skips defusing the argument. #' @details #' `srv_decorate_teal_data` is a wrapper around `srv_transform_teal_data` that #' allows to decorate the data with additional expressions. diff --git a/man/srv_decorate_teal_data.Rd b/man/srv_decorate_teal_data.Rd index 6ed8a4399..18201124e 100644 --- a/man/srv_decorate_teal_data.Rd +++ b/man/srv_decorate_teal_data.Rd @@ -18,7 +18,8 @@ ui_decorate_teal_data(id, decorators, ...) When an expression it must be inline code. See \code{\link[=within]{within()}} Default is \code{NULL} which won't evaluate any appending code.} -\item{expr_is_reactive}{()} +\item{expr_is_reactive}{(\code{logical(1)}) whether \code{expr} is a reactive expression +that skips defusing the argument.} } \description{ Wrappers around \code{srv_transform_teal_data} that allows to decorate the data