View source: R/tm_g_lineplot.R
tm_g_lineplot | R Documentation |
This module produces a ggplot2::ggplot()
type line plot, with optional summary table, for standard ADaM data.
tm_g_lineplot(
label,
dataname,
parentname = NULL,
strata = lifecycle::deprecated(),
group_var =
teal.transform::choices_selected(teal.transform::variable_choices(parentname,
c("ARM", "ARMCD", "ACTARMCD")), "ARM"),
x = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVISIT"), "AVISIT", fixed = TRUE),
y = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
c("AVAL", "BASE", "CHG", "PCHG")), "AVAL"),
y_unit = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVALU"), "AVALU", fixed = TRUE),
paramcd = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"PARAMCD"), "PARAMCD", fixed = TRUE),
param = teal.transform::choices_selected(teal.transform::value_choices(dataname,
"PARAMCD", "PARAM"), "ALT"),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
interval = "mean_ci",
mid = "mean",
whiskers = c("mean_ci_lwr", "mean_ci_upr"),
table = c("n", "mean_sd", "median", "range"),
mid_type = "pl",
mid_point_size = c(2, 1, 5),
table_font_size = c(4, 2, 6),
plot_height = c(1000L, 200L, 4000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
a teal_module
object.
This module generates the following objects, which can be modified in place using decorators:
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-module-output", package = "teal.modules.clinical")
.
To learn more please refer to the vignette
vignette("transform-module-output", package = "teal")
or the teal::teal_transform_module()
documentation.
The TLG Catalog where additional example apps implementing this module can be found.
library(nestcolor)
library(dplyr)
library(forcats)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb %>%
mutate(AVISIT == fct_reorder(AVISIT, AVISITN, min))
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_g_lineplot(
label = "Line Plot",
dataname = "ADLB",
group_var = choices_selected(
variable_choices(ADSL, c("ARM", "ARMCD", "ACTARMCD")),
"ARM"
),
y = choices_selected(
variable_choices(ADLB, c("AVAL", "BASE", "CHG", "PCHG")),
"AVAL"
),
param = choices_selected(
value_choices(ADLB, "PARAMCD", "PARAM"),
"ALT"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.