g_lineplot | R Documentation |
Line plot with the optional table.
g_lineplot(
df,
alt_counts_df = NULL,
variables = control_lineplot_vars(),
mid = "mean",
interval = "mean_ci",
whiskers = c("mean_ci_lwr", "mean_ci_upr"),
table = NULL,
sfun = s_summary,
...,
mid_type = "pl",
mid_point_size = 2,
position = ggplot2::position_dodge(width = 0.4),
legend_title = NULL,
legend_position = "bottom",
ggtheme = nestcolor::theme_nest(),
xticks = NULL,
xlim = NULL,
ylim = NULL,
x_lab = obj_label(df[[variables[["x"]]]]),
y_lab = NULL,
y_lab_add_paramcd = TRUE,
y_lab_add_unit = TRUE,
title = "Plot of Mean and 95% Confidence Limits by Visit",
subtitle = "",
subtitle_add_paramcd = TRUE,
subtitle_add_unit = TRUE,
caption = NULL,
table_format = NULL,
table_labels = NULL,
table_font_size = 3,
errorbar_width = 0.45,
newpage = lifecycle::deprecated(),
col = NULL,
linetype = NULL
)
df |
( |
alt_counts_df |
( |
variables |
(named
|
mid |
( |
interval |
( |
whiskers |
( |
table |
( |
sfun |
( |
... |
optional arguments to |
mid_type |
( |
mid_point_size |
( |
position |
( |
legend_title |
( |
legend_position |
( |
ggtheme |
( |
xticks |
( |
xlim |
( |
ylim |
( |
x_lab |
( |
y_lab |
( |
y_lab_add_paramcd |
( |
y_lab_add_unit |
( |
title |
( |
subtitle |
( |
subtitle_add_paramcd |
( |
subtitle_add_unit |
( |
caption |
( |
table_format |
(named |
table_labels |
(named |
table_font_size |
( |
errorbar_width |
( |
newpage |
|
col |
( |
linetype |
( |
A ggplot
line plot (and statistics table if applicable).
library(nestcolor)
adsl <- tern_ex_adsl
adlb <- tern_ex_adlb %>% dplyr::filter(ANL01FL == "Y", PARAMCD == "ALT", AVISIT != "SCREENING")
adlb$AVISIT <- droplevels(adlb$AVISIT)
adlb <- dplyr::mutate(adlb, AVISIT = forcats::fct_reorder(AVISIT, AVISITN, min))
# Mean with CI
g_lineplot(adlb, adsl, subtitle = "Laboratory Test:")
# Mean with CI, no stratification with group_var
g_lineplot(adlb, variables = control_lineplot_vars(group_var = NA))
# Mean, upper whisker of CI, no group_var(strata) counts N
g_lineplot(
adlb,
whiskers = "mean_ci_upr",
title = "Plot of Mean and Upper 95% Confidence Limit by Visit"
)
# Median with CI
g_lineplot(
adlb,
adsl,
mid = "median",
interval = "median_ci",
whiskers = c("median_ci_lwr", "median_ci_upr"),
title = "Plot of Median and 95% Confidence Limits by Visit"
)
# Mean, +/- SD
g_lineplot(adlb, adsl,
interval = "mean_sdi",
whiskers = c("mean_sdi_lwr", "mean_sdi_upr"),
title = "Plot of Median +/- SD by Visit"
)
# Mean with CI plot with stats table
g_lineplot(adlb, adsl, table = c("n", "mean", "mean_ci"))
# Mean with CI, table and customized confidence level
g_lineplot(
adlb,
adsl,
table = c("n", "mean", "mean_ci"),
control = control_analyze_vars(conf_level = 0.80),
title = "Plot of Mean and 80% Confidence Limits by Visit"
)
# Mean with CI, table, filtered data
adlb_f <- dplyr::filter(adlb, ARMCD != "ARM A" | AVISIT == "BASELINE")
g_lineplot(adlb_f, table = c("n", "mean"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.