Skip to content
7 changes: 5 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Imports:
teal.code (>= 0.7.0),
teal.data (>= 0.8.0),
teal.logger (>= 0.4.0),
teal.picks (>= 0.1.0),
teal.reporter (>= 0.6.0),
teal.widgets (>= 0.5.0),
tern (>= 0.9.7),
Expand All @@ -49,10 +50,12 @@ Suggests:
testthat (>= 3.2.3),
withr (>= 3.0.0)
Remotes:
insightsengineering/osprey
insightsengineering/osprey,
insightsengineering/teal.picks@redesign_exptraction@main
Config/Needs/verdepcheck: insightsengineering/osprey, rstudio/shiny,
insightsengineering/teal, insightsengineering/teal.slice,
insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr,
insightsengineering/teal.transform, insightsengineering/teal.picks,
mllg/checkmate, tidyverse/dplyr,
insightsengineering/formatters, tidyverse/ggplot2, r-lib/lifecycle,
daroczig/logger, rstudio/shinyvalidate, insightsengineering/teal.code,
insightsengineering/teal.logger, insightsengineering/teal.reporter,
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Generated by roxygen2: do not edit by hand

S3method(tm_g_events_term_id,default)
S3method(tm_g_events_term_id,picks)
export(label_aevar)
export(plot_decorate_output)
export(quick_filter)
Expand Down
51 changes: 44 additions & 7 deletions R/tm_g_events_term_id.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@
#'
#' @description
#'
#' Display Events by Term plot as a shiny module
#' Display Events by Term plot as a shiny module.
#'
#' This is an S3 generic that dispatches on the class of `term_var`:
#' - [choices_selected][teal.transform::choices_selected()] dispatches to the
#' default method.
#' - [picks][teal.picks::picks()] dispatches to the picks method.
#'
#' @inheritParams teal.widgets::standard_layout
#' @inheritParams teal::module
#' @inheritParams argument_convention
#' @param term_var [teal.transform::choices_selected] object with all available choices
#' and pre-selected option names that can be used to specify the term for events
#' @param term_var A variable selection object. Either a
#' [teal.transform::choices_selected()] object (dispatches to the `.default`
#' method) or a [teal.picks::picks()] object (dispatches to the `.picks`
#' method).
#' @param dataname (`character(1)`) Name of the events dataset. Required when
#' using the default method with [choices_selected][teal.transform::choices_selected()].
#' Ignored by the `.picks` method.
#'
#' @inherit argument_convention return
#' @inheritSection teal::example_module Reporting
Expand All @@ -27,6 +37,7 @@
#'
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' # Using the default method (choices_selected)
#' app <- init(
#' data = data,
#' modules = modules(
Expand All @@ -52,16 +63,42 @@
#' shinyApp(app$ui, app$server)
#' }
#'
tm_g_events_term_id <- function(label,
dataname,
term_var,
arm_var,
tm_g_events_term_id <- function(label = "Common AE",
dataname = NULL,
term_var = teal.picks::picks(
teal.picks::datasets(),
teal.picks::variables(
choices = teal.picks::is_categorical(min.len = 2),
selected = 1L
)
),
arm_var = teal.picks::picks(
teal.picks::datasets(),
teal.picks::variables(
choices = teal.picks::is_categorical(min.len = 2),
selected = 1L
)
),
Comment thread
m7pr marked this conversation as resolved.
fontsize = c(5, 3, 7),
plot_height = c(600L, 200L, 2000L),
plot_width = NULL,
transformators = list()) {
UseMethod("tm_g_events_term_id", term_var)
}

#' @rdname tm_g_events_term_id
#' @export
tm_g_events_term_id.default <- function(label = "Common AE", # nolint: object_name_linter.
dataname = NULL,
term_var,
arm_var,
fontsize = c(5, 3, 7),
plot_height = c(600L, 200L, 2000L),
plot_width = NULL,
transformators = list()) {
message("Initializing tm_g_events_term_id")
checkmate::assert_string(label)
checkmate::assert_string(dataname)
checkmate::assert_class(term_var, classes = "choices_selected")
checkmate::assert_class(arm_var, classes = "choices_selected")
checkmate::assert(
Expand Down
Loading