R/g_mean_slides.R
g_mean_general.Rd
adapted from https://insightsengineering.github.io/tlg-catalog/stable/graphs/other/mng01.html
g_mean_general(
adsl,
data,
variables = control_lineplot_vars(group_var = "TRT01P"),
by_vars = c("USUBJID", "STUDYID"),
subtitle = "Plot of Mean and 95% Confidence Limits by Visit.",
...
)
ADSL dataset
dataset containing the variable of interest in PARAMCD and AVAL
(named character
) vector of variable names in df
which should include:
x
(string
)
name of x-axis variable.
y
(string
)
name of y-axis variable.
group_var
(string
or NULL
)
name of grouping variable (or strata), i.e. treatment arm.
Can be NA
to indicate lack of groups.
subject_var
(string
or NULL
)
name of subject variable. Only applies if group_var
is
not NULL.
paramcd
(string
or NA
)
name of the variable for parameter's code. Used for y-axis label and plot's
subtitle. Can be NA
if paramcd
is not to be added to the y-axis label or subtitle.
y_unit
(string
or NA
)
name of variable with units of y
. Used for y-axis label and plot's subtitle.
Can be NA
if y unit is not to be added to the y-axis label or subtitle.
facet_var
(string
or NA
)
name of the secondary grouping variable used for plot faceting, i.e. treatment
arm. Can be NA
to indicate lack of groups.
variables to merge the two datasets by
character scalar forwarded to g_lineplot
additional arguments passed to `tern::g_lineplot`
library(dplyr)
advs_filtered <- eg_advs %>% filter(
PARAMCD == "SYSBP"
)
out1 <- g_mean_general(eg_adsl, advs_filtered)
generate_slides(out1, paste0(tempdir(), "/g_mean.pptx"))
#> Warning: Calling `add_slide()` without specifying a `layout` is deprecated.
#> Please pass a `layout` or use `layout_default()` to set a default.
#> => I will now continue with the former `layout` default "Title and Content" for backwards compatibility...