cont_cat_panel | R Documentation |
Get a single graphic of continuous covariate boxplots split by
levels of different categorical covariates (cont_cat_panel()
).
Alternatively, get the component plots to be arranged by the user
(cont_cat_panel_list()
)
cont_cat_panel(
df,
x,
y,
ncol = 2,
tag_levels = NULL,
byrow = FALSE,
transpose = FALSE,
...
)
cont_cat_panel_list(df, x, y, transpose = FALSE, ...)
df |
a data frame to plot. |
x |
character |
y |
character |
ncol |
passed to |
tag_levels |
passed to |
byrow |
passed to |
transpose |
logical; if |
... |
additional arguments passed to |
Pass ncol = NULL
or another non-numeric value to bypass arranging plots
coming from cont_cat_panel()
.
cont_cat_panel()
returns a list of plots arranged in graphics as a
patchwork
object using pm_grid()
. cont_cat_panel_list()
returns the
same plots, but unarranged as a named list of lists.
When transpose
is FALSE
(default), plots in a single graphic are grouped
by the continuous covariates (passed as y
), and the names of the list
reflect those names (e.g., WT
). When transpose
is TRUE
, the graphics
are grouped by the categorical covariates (passed as x
) and the names of
the list reflect those names (e.g. RF
). See Examples.
eta_covariate()
, eta_covariate_list()
data <- pmplots_data_id()
cont <- c("WT//Weight (kg)", "ALB//Albumin (mg/dL)", "AGE//Age (years)")
cats <- c("RF//Renal function", "CPc//Child-Pugh")
cont_cat_panel(data, x = cats, y = cont, tag_levels = "A")
cont_cat_panel(data, cats, cont)
cont_cat_panel(data, cats, cont, transpose = TRUE)
l <- cont_cat_panel_list(data, cats, cont, transpose = TRUE)
names(l)
with(l$RF, WT/(ALB + AGE), tag_levels = "A")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.