|
1 | | -#' Stack Plots of variables and show association with reference variable |
2 | | -#' @md |
| 1 | +#' Stack plots of variables and show association with reference variable |
| 2 | +#' |
| 3 | +#' Module provides functionality for visualizing the distribution of variables and |
| 4 | +#' their association with a reference variable. |
| 5 | +#' It supports configuring the appearance of the plots, including themes and whether to show associations. |
| 6 | +#' |
| 7 | +#' |
| 8 | +#' @note For more examples, please see the vignette "Using association plot" via |
| 9 | +#' `vignette("using-association-plot", package = "teal.modules.general")`. |
3 | 10 | #' |
4 | 11 | #' @inheritParams teal::module |
5 | 12 | #' @inheritParams shared_params |
6 | 13 | #' @param ref (`data_extract_spec` or `list` of multiple `data_extract_spec`) |
7 | | -#' reference variable, must set `multiple = FALSE`. |
| 14 | +#' Reference variable, must accepts a `data_extract_spec` with `select_spec(multiple = FALSE)` |
| 15 | +#' to ensure single selection option. |
8 | 16 | #' @param vars (`data_extract_spec` or `list` of multiple `data_extract_spec`) |
9 | | -#' associated variables. |
10 | | -#' @param show_association optional, (`logical`) Whether show association of `vars` |
11 | | -#' with reference variable. Defaults to `TRUE`. |
12 | | -#' @param distribution_theme,association_theme optional, (`character`) `ggplot2` themes to be used by default. |
13 | | -#' Default to `"gray"`. |
| 17 | +#' Variables to be associated with the reference variable. |
| 18 | +#' @param show_association (`logical`) optional whether show association of `vars` |
| 19 | +#' with reference variable. Defaults to `TRUE`. |
| 20 | +#' @param distribution_theme,association_theme (`character`) optional `ggplot2` themes to be used by default. |
| 21 | +#' Default to `"gray"`. |
14 | 22 | #' |
15 | 23 | #' @templateVar ggnames "Bivariate1", "Bivariate2" |
16 | 24 | #' @template ggplot2_args_multi |
17 | 25 | #' |
18 | | -#' @note For more examples, please see the vignette "Using association plot" via |
19 | | -#' \code{vignette("using-association-plot", package = "teal.modules.general")}. |
20 | | -#' |
21 | 26 | #' @examples |
22 | | -#' # general data exapmle |
23 | 27 | #' library(teal.widgets) |
24 | 28 | #' |
| 29 | +#' # general data example |
25 | 30 | #' data <- teal_data() |
26 | 31 | #' data <- within(data, { |
27 | 32 | #' require(nestcolor) |
|
65 | 70 | #' } |
66 | 71 | #' |
67 | 72 | #' # CDISC data example |
68 | | -#' library(teal.widgets) |
69 | | -#' |
70 | 73 | #' data <- teal_data() |
71 | 74 | #' data <- within(data, { |
72 | 75 | #' require(nestcolor) |
@@ -172,6 +175,7 @@ tm_g_association <- function(label = "Association", |
172 | 175 | ) |
173 | 176 | } |
174 | 177 |
|
| 178 | +# UI function for the association module |
175 | 179 | ui_tm_g_association <- function(id, ...) { |
176 | 180 | ns <- NS(id) |
177 | 181 | args <- list(...) |
@@ -249,6 +253,7 @@ ui_tm_g_association <- function(id, ...) { |
249 | 253 | ) |
250 | 254 | } |
251 | 255 |
|
| 256 | +# Server function for the association module |
252 | 257 | srv_tm_g_association <- function(id, |
253 | 258 | data, |
254 | 259 | reporter, |
|
0 commit comments