|
1 | 1 | #' Template: Individual Patient Plots |
2 | 2 | #' |
| 3 | +#' Creates a valid expression to generate [ggplot2::ggplot()] plots of individual patients. |
| 4 | +#' |
3 | 5 | #' @inheritParams template_arguments |
4 | | -#' @param avalu_var (`string`)\cr variable name designating the unit of the analysis variable. |
5 | | -#' @param baseline_var (`string`)\cr variable name designating the baseline values of analysis variable. |
6 | | -#' @param visit_var (`string`)\cr variable name designating the visit timepoint variable. |
7 | | -#' @param add_baseline_hline (`flag`)\cr adds horizontal line at baseline y-value on plot |
8 | | -#' @param separate_by_obs (`flag`)\cr creates multi panel plots when TRUE |
9 | | -#' @param suppress_legend (`flag`)\cr allow user to suppress legend |
10 | | -#' @param arm_levels (`character`)\cr vector of all arm variable levels. |
11 | | -#' @param avalu_first (`string`)\cr `avalu` value. |
12 | | -#' @param paramcd_first (`string`)\cr `paramcd` value. |
13 | | -#' @param add_avalu (`flag`)\cr allow user to not display value unit in the plot. |
14 | | -#' @param ggplot2_args optional, (`ggplot2_args`)\cr |
15 | | -#' object created by [teal.widgets::ggplot2_args()] with settings for the module plot. |
16 | | -#' For this module, this argument will only accept `ggplot2_args` object with `labs` list of following child elements: |
17 | | -#' `title`, `subtitle`, `x`, `y`. |
18 | | -#' No other elements would be taken into account. The argument is merged with option `teal.ggplot2_args` and |
19 | | -#' with default module arguments (hard coded in the module body). |
| 6 | +#' @param visit_var (`character`)\cr name of the variable for visit timepoints. |
| 7 | +#' @param add_baseline_hline (`logical`)\cr whether a horizontal line should be added to the plot at baseline y-value. |
| 8 | +#' @param separate_by_obs (`logical`)\cr whether to create multi-panel plots. |
| 9 | +#' @param suppress_legend (`logical`)\cr whether to suppress the plot legend. |
| 10 | +#' @param arm_levels (`character`)\cr vector of all levels of `arm_var`. |
| 11 | +#' @param avalu_first (`character`)\cr `avalu_var` text to append to the plot title and y-axis label if `add_avalu` is |
| 12 | +#' `TRUE`. |
| 13 | +#' @param paramcd_first (`character`)\cr `paramcd` text to append to the plot title and y-axis label. |
| 14 | +#' @param add_avalu (`logical`)\cr whether `avalu_first` text should be appended to the plot title and y-axis label. |
| 15 | +#' @param ggplot2_args optional, (`ggplot2_args`)\cr object created by [teal.widgets::ggplot2_args()] with settings |
| 16 | +#' for the module plot. For this module, this argument will only accept `ggplot2_args` object with `labs` list of |
| 17 | +#' the following child elements: `title`, `subtitle`, `x`, `y`. No other elements are taken into account. The |
| 18 | +#' argument is merged with option `teal.ggplot2_args` and with default module arguments (hard coded in the module |
| 19 | +#' body). |
20 | 20 | #' |
21 | | -#' For more details, see the vignette: `vignette("custom-ggplot2-arguments", package = "teal.widgets")`. |
22 | | -#' @keywords internal |
| 21 | +#' For more details, see the vignette: `vignette("custom-ggplot2-arguments", package = "teal.widgets")`. |
| 22 | +#' |
| 23 | +#' @inherit template_arguments return |
23 | 24 | #' |
| 25 | +#' @seealso [tm_g_ipp()] |
| 26 | +#' |
| 27 | +#' @keywords internal |
24 | 28 | template_g_ipp <- function(dataname = "ANL", |
25 | 29 | paramcd, |
26 | 30 | arm_var, |
@@ -93,8 +97,6 @@ template_g_ipp <- function(dataname = "ANL", |
93 | 97 | ) |
94 | 98 | ) |
95 | 99 |
|
96 | | - |
97 | | - |
98 | 100 | graph_list <- list() |
99 | 101 | graph_list <- add_expr( |
100 | 102 | graph_list, |
@@ -167,27 +169,20 @@ template_g_ipp <- function(dataname = "ANL", |
167 | 169 | y |
168 | 170 | } |
169 | 171 |
|
170 | | -#' Teal Module: Individual Patient Plot |
| 172 | +#' teal Module: Individual Patient Plots |
171 | 173 | #' |
172 | | -#' This teal module produces grid style Individual patient plot(s) that show |
173 | | -#' trends in parameter values over time for each patient using data with |
174 | | -#' `ADaM` structure. |
| 174 | +#' This module produces [ggplot2::ggplot()] type individual patient plots that display trends in parameter |
| 175 | +#' values over time for each patient, using data with ADaM structure. |
175 | 176 | #' |
176 | 177 | #' @inheritParams module_arguments |
177 | 178 | #' @inheritParams template_g_ipp |
178 | | -#' @param arm_var ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr |
179 | | -#' object with all available choices |
180 | | -#' and preselected option for variable values that can be used as `arm_var`. |
181 | | -#' @param ggplot2_args optional, (`ggplot2_args`)\cr |
182 | | -#' object created by [teal.widgets::ggplot2_args()] with settings for the module plot. |
183 | | -#' For this module, this argument will only accept `ggplot2_args` object with `labs` list of following child elements: |
184 | | -#' `title`, `subtitle`, `x`, `y`. |
185 | | -#' No other elements would be taken into account. The argument is merged with option `teal.ggplot2_args` and |
186 | | -#' with default module arguments (hard coded in the module body). |
| 179 | +#' @param arm_var ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with |
| 180 | +#' all available choices and preselected option for variable values that can be used as arm variable. |
187 | 181 | #' |
188 | | -#' For more details, see the vignette: `vignette("custom-ggplot2-arguments", package = "teal.widgets")`. |
| 182 | +#' @inherit module_arguments return |
189 | 183 | #' |
190 | | -#' @export |
| 184 | +#' @seealso The [TLG Catalog](https://insightsengineering.github.io/tlg-catalog/stable/) where additional example |
| 185 | +#' apps implementing this module can be found. |
191 | 186 | #' |
192 | 187 | #' @examples |
193 | 188 | #' library(nestcolor) |
@@ -254,6 +249,7 @@ template_g_ipp <- function(dataname = "ANL", |
254 | 249 | #' shinyApp(ui = app$ui, server = app$server) |
255 | 250 | #' } |
256 | 251 | #' |
| 252 | +#' @export |
257 | 253 | tm_g_ipp <- function(label, |
258 | 254 | dataname, |
259 | 255 | parentname = ifelse( |
@@ -358,7 +354,7 @@ tm_g_ipp <- function(label, |
358 | 354 | ) |
359 | 355 | } |
360 | 356 |
|
361 | | - |
| 357 | +#' @keywords internal |
362 | 358 | ui_g_ipp <- function(id, ...) { |
363 | 359 | a <- list(...) # module args |
364 | 360 | is_single_dataset_value <- teal.transform::is_single_dataset( |
@@ -460,6 +456,7 @@ ui_g_ipp <- function(id, ...) { |
460 | 456 | ) |
461 | 457 | } |
462 | 458 |
|
| 459 | +#' @keywords internal |
463 | 460 | srv_g_ipp <- function(id, |
464 | 461 | data, |
465 | 462 | reporter, |
|
0 commit comments