|
42 | 42 | #' |
43 | 43 | #' @inherit shared_params return |
44 | 44 | #' |
45 | | -#' @section Decorating Module Outputs: |
46 | | -#' |
47 | | -#' Decorating module outputs involves modifying the tables and plots generated by a module. This module provides the |
48 | | -#' ability to execute custom R code to adjust the visual or structural properties of objects displayed within the |
49 | | -#' application. |
50 | | -#' |
51 | | -#' The code specified in [`teal_transform_module`] is executed prior to rendering the outputs in the application. This |
52 | | -#' allows developers to modify attributes such as titles, labels, sizes, limits, and other features of rendered tables |
53 | | -#' and plots. However, decorators should be applied with careful consideration of the module's internal object names |
54 | | -#' to ensure compatibility. |
55 | | -#' |
56 | | -#' To customize an output, developers need to identify the name of the table or plot to be modified within the |
57 | | -#' `teal_transform_module`. This requires specifying a `server` function that modifies the targeted object in the |
58 | | -#' `data` object (of class `teal_data`). Since each module may use different internal object names or types for its |
59 | | -#' outputs, there is no universal code to achieve this. However, `teal` provides convenient wrappers to simplify the |
60 | | -#' process of decorating module outputs: |
| 45 | +#' @section Decorating `tm_a_regression`: |
61 | 46 | #' |
62 | | -#' - **Decorator as a Language/Expression**: Specify a simple R expression to modify the object of interest. |
63 | | -#' For example,`plot <- plot + ggtitle("Custom Title")`. The expression must be valid and compatible with the module's |
64 | | -#' internal environment. |
65 | | -#' - **Decorator as a Function**: Provide a function that accepts the output object and modifies it as desired. |
66 | | -#' When using this approach, the function does not need to align with the module’s internal naming conventions for its |
67 | | -#' objects. |
| 47 | +#' This module creates below objects that can be modified with decorators: |
| 48 | +#' - `plot` (`ggplot2`) |
68 | 49 | #' |
69 | 50 | #' For additional details and examples of decorators, refer to the vignette |
70 | 51 | #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. |
71 | 52 | #' |
72 | | -#' @section Decorating `tm_a_regression`: |
73 | | -#' |
74 | | -#' This module creates below objects that can be modified with decorators: |
75 | | -#' - `plot` (`ggplot2`)#' |
76 | | -#' |
77 | 53 | #' @examplesShinylive |
78 | 54 | #' library(teal.modules.general) |
79 | 55 | #' interactive <- function() TRUE |
80 | 56 | #' {{ next_example }} |
81 | 57 | #' @examples |
82 | 58 | #' |
83 | | -#' footnote_regression <- teal_transform_module( |
84 | | -#' server = make_teal_transform_server(expression( |
85 | | -#' plot <- plot + labs(caption = deparse(summary(fit)[[1]])) |
86 | | -#' )) |
87 | | -#' ) |
88 | | -#' |
89 | 59 | #' # general data example |
90 | 60 | #' data <- teal_data() |
91 | 61 | #' data <- within(data, { |
|
117 | 87 | #' multiple = TRUE, |
118 | 88 | #' fixed = FALSE |
119 | 89 | #' ) |
120 | | -#' ), |
121 | | -#' decorators = list(footnote_regression) |
| 90 | +#' ) |
122 | 91 | #' ) |
123 | 92 | #' ) |
124 | 93 | #' ) |
|
163 | 132 | #' multiple = TRUE, |
164 | 133 | #' fixed = FALSE |
165 | 134 | #' ) |
166 | | -#' ), |
167 | | -#' decorators = list(footnote_regression) |
| 135 | +#' ) |
168 | 136 | #' ) |
169 | 137 | #' ) |
170 | 138 | #' ) |
|
0 commit comments