Skip to content

Commit

Permalink
Merge c525a64 into 25b6ad0
Browse files Browse the repository at this point in the history
  • Loading branch information
vedhav authored Feb 21, 2025
2 parents 25b6ad0 + c525a64 commit ded09df
Show file tree
Hide file tree
Showing 78 changed files with 1,011 additions and 276 deletions.
8 changes: 4 additions & 4 deletions R/string_ops.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@ as_num.character <- function(str) {
y <- lapply(y, as.numeric)
y[unlist(lapply(y, length) == 0)] <- NA

return(y)
y
}

#' @export
#' @rdname as_num
as_num.numeric <- function(str) {
return(str)
str
}

#' @export
#' @rdname as_num
as_num.factor <- function(str) {
y <- as.character(str)
y <- as_num(y)
return(y)
y
}

#' @export
#' @rdname as_num
as_num.logical <- function(str) {
y <- as.numeric(str)
return(y)
y
}
16 changes: 14 additions & 2 deletions R/tm_a_gee.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,21 @@ template_a_gee <- function(output_table,
#' This module generates the following objects, which can be modified in place using decorators:
#' - `table` (`ElementaryTable` - output of `rtables::build_table`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_a_gee(
#' ..., # arguments for module
#' decorators = list(
#' table = teal_transform_module(...) # applied to the `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.clinical)
Expand Down Expand Up @@ -228,7 +241,6 @@ tm_a_gee <- function(label,
checkmate::assert_class(pre_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(basic_table_args, "basic_table_args")
decorators <- normalize_decorators(decorators)
assert_decorators(decorators, "table")

args <- as.list(environment())
Expand Down
33 changes: 17 additions & 16 deletions R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -462,32 +462,34 @@ template_mmrm_plots <- function(fit_name,
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `lsmeans_plot` (`ggplot2`)
#' - `diagnostic_plot` (`TableTree`- output from `rtables::build_table`)
#' - `lsmeans_plot` (`ggplot`)
#' - `diagnostic_plot` (`ggplot`)
#' - `lsmeans_table` (`TableTree`- output from `rtables::build_table`)
#' - `covariance_table` (`TableTree`- output from `rtables::build_table`)
#' - `fixed_effects_table` (`TableTree`- output from `rtables::build_table`)
#' - `diagnostic_table` (`TableTree`- output from `rtables::build_table`)
#' - `covariance_table` (`ElementaryTable`- output from `rtables::build_table`)
#' - `fixed_effects_table` (`ElementaryTable`- output from `rtables::build_table`)
#' - `diagnostic_table` (`ElementaryTable`- output from `rtables::build_table`)
#'
#' 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.
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_a_mrmm(
#' ..., # arguments for module
#' decorators = list(
#' default = list(teal_transform_module(...)), # applied to all outputs
#' lsmeans_plot = list(teal_transform_module(...)) # applied only to `lsmeans_plot` output
#' diagnostic_plot = list(teal_transform_module(...)) # applied only to `diagnostic_plot` output
#' lsmeans_table = list(teal_transform_module(...)) # applied only to `lsmeans_table` output
#' covariance_table = list(teal_transform_module(...)) # applied only to `covariance_table` output
#' fixed_effects_table = list(teal_transform_module(...)) # applied only to `fixed_effects_table` output
#' diagnostic_table = list(teal_transform_module(...)) # applied only to `diagnostic_table` output
#' lsmeans_plot = teal_transform_module(...), # applied only to `lsmeans_plot` output
#' diagnostic_plot = teal_transform_module(...), # applied only to `diagnostic_plot` output
#' lsmeans_table = teal_transform_module(...), # applied only to `lsmeans_table` output
#' covariance_table = teal_transform_module(...), # applied only to `covariance_table` output
#' fixed_effects_table = teal_transform_module(...), # applied only to `fixed_effects_table` output
#' diagnostic_table = teal_transform_module(...) # applied only to `diagnostic_table` output
#' )
#' )
#' ```
#'
#' For additional details and examples of decorators, refer to the vignette
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.clinical)
#' interactive <- function() TRUE
Expand Down Expand Up @@ -600,7 +602,6 @@ tm_a_mmrm <- function(label,
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,
c(
Expand Down
18 changes: 15 additions & 3 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,23 @@
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `plot` (`ggplot2`)
#' - `plot` (`ggplot`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_g_barchart_simple(
#' ..., # arguments for module
#' decorators = list(
#' plot = teal_transform_module(...) # applied only to `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.clinical)
Expand Down Expand Up @@ -182,7 +195,6 @@ tm_g_barchart_simple <- function(x = NULL,
checkmate::assert_class(pre_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(ggplot2_args, "ggplot2_args")
decorators <- normalize_decorators(decorators)
assert_decorators(decorators, names = "plot")

plot_options <- utils::modifyList(
Expand Down
18 changes: 15 additions & 3 deletions R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,23 @@ template_g_ci <- function(dataname,
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `plot` (`ggplot2`)
#' - `plot` (`ggplot`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_g_ci(
#' ..., # arguments for module
#' decorators = list(
#' plot = teal_transform_module(...) # applied only to `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.clinical)
Expand Down Expand Up @@ -310,7 +323,6 @@ tm_g_ci <- function(label,
checkmate::assert_class(pre_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(ggplot2_args, "ggplot2_args")
decorators <- normalize_decorators(decorators)
assert_decorators(decorators, "plot")

args <- as.list(environment())
Expand Down
18 changes: 15 additions & 3 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,23 @@ template_forest_rsp <- function(dataname = "ANL",
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `plot` (`ggplot2`)
#' - `plot` (`ggplot`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_g_forest_rsp(
#' ..., # arguments for module
#' decorators = list(
#' plot = teal_transform_module(...) # applied only to `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.clinical)
Expand Down Expand Up @@ -392,7 +405,6 @@ tm_g_forest_rsp <- function(label,
checkmate::assert_class(pre_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(ggplot2_args, "ggplot2_args")
decorators <- normalize_decorators(decorators)
assert_decorators(decorators, "plot")

args <- as.list(environment())
Expand Down
18 changes: 15 additions & 3 deletions R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,23 @@ template_forest_tte <- function(dataname = "ANL",
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `plot` (`ggplot2`)
#' - `plot` (`ggplot`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_g_forest_tte(
#' ..., # arguments for module
#' decorators = list(
#' plot = teal_transform_module(...) # applied only to `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.clinical)
Expand Down Expand Up @@ -378,7 +391,6 @@ tm_g_forest_tte <- function(label,
checkmate::assert_class(pre_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(ggplot2_args, "ggplot2_args")
decorators <- normalize_decorators(decorators)
assert_decorators(decorators, "plot")

args <- as.list(environment())
Expand Down
18 changes: 15 additions & 3 deletions R/tm_g_ipp.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,23 @@ template_g_ipp <- function(dataname = "ANL",
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `plot` (`ggplot2`)
#' - `plot` (`ggplot`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_g_ipp(
#' ..., # arguments for module
#' decorators = list(
#' plot = teal_transform_module(...) # applied only to `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#'
#' @examplesShinylive
Expand Down Expand Up @@ -341,7 +354,6 @@ tm_g_ipp <- function(label,
checkmate::assert_class(pre_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(ggplot2_args, "ggplot2_args")
decorators <- normalize_decorators(decorators)
assert_decorators(decorators, "plot")

args <- as.list(environment())
Expand Down
18 changes: 15 additions & 3 deletions R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,23 @@ template_g_km <- function(dataname = "ANL",
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `plot` (`ggplot2`)
#' - `plot` (`ggplot`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_g_km(
#' ..., # arguments for module
#' decorators = list(
#' plot = teal_transform_module(...) # applied only to `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#'
#' @examplesShinylive
Expand Down Expand Up @@ -398,7 +411,6 @@ tm_g_km <- function(label,
)
checkmate::assert_class(pre_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
decorators <- normalize_decorators(decorators)
assert_decorators(decorators, "plot")

args <- as.list(environment())
Expand Down
18 changes: 15 additions & 3 deletions R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,23 @@ template_g_lineplot <- function(dataname = "ANL",
#' @section Decorating Module:
#'
#' This module generates the following objects, which can be modified in place using decorators:
#' - `plot` (`ggplot2`)
#' - `plot` (`ggplot`)
#'
#' A Decorator is applied to the specific output using a named list of `teal_transform_module` objects.
#' The name of this list corresponds to the name of the output to which the decorator is applied.
#' See code snippet below:
#'
#' ```
#' tm_g_lineplot(
#' ..., # arguments for module
#' decorators = list(
#' plot = teal_transform_module(...) # applied only to `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.
#' `vignette("transform-module-output", package = "teal")` or the [`teal::teal_transform_module()`] documentation.
#'
#' @examplesShinylive
#' library(teal.modules.clinical)
Expand Down Expand Up @@ -349,7 +362,6 @@ tm_g_lineplot <- function(label,
checkmate::assert_class(post_output, classes = "shiny.tag", null.ok = TRUE)
checkmate::assert_class(ggplot2_args, "ggplot2_args")

decorators <- normalize_decorators(decorators)
assert_decorators(decorators, "plot")

args <- as.list(environment())
Expand Down
Loading

0 comments on commit ded09df

Please sign in to comment.