eta_covariate: Create ETA versus covariate displays

View source: R/displays.R

eta_covariateR Documentation

Create ETA versus covariate displays

Description

Get a single graphic of ETA versus continuous and / or categorical covariates (eta_covariate()) or the component plots as a list that can be arranged by the user (eta_covariate_list()).

Usage

eta_covariate(
  df,
  x,
  y,
  ncol = 2,
  tag_levels = NULL,
  byrow = NULL,
  transpose = FALSE
)

eta_covariate_list(df, x, y, transpose = FALSE)

Arguments

df

a data frame to plot.

x

character ⁠col//title⁠ for covariates to plot on x-axis; see col_label().

y

character ⁠col//title⁠ for ETAs to plot on y-axis; see col_label().

ncol

passed to pm_grid().

tag_levels

passed to patchwork::plot_annotation().

byrow

passed to pm_grid().

transpose

logical; if TRUE, output will be transposed to group plots by the covariate, rather than the ETA; see Examples.

Details

Pass ncol = NULL or another non-numeric value to bypass arranging plots coming from eta_covariate().

Value

eta_covariate() returns a list of plots arranged in graphics as a patchwork object using pm_grid(). eta_covariate_list() the same plots, but unarranged as a list of lists.

When transpose is FALSE (default), plots in a single graphic are grouped by the ETA, and the names of the list reflect that name (e.g., ETA1). When transpose is TRUE, the graphics are grouped by column names passed via x and the names of the list reflect those covariate data names. See Examples.

See Also

npde_covariate(), cwres_covariate()

Examples

data <- pmplots_data_id()
etas <- c("ETA1//ETA-CL", "ETA2//ETA-V")
cont <- c("WT//Weight (kg)", "ALB//Albumin (mg/dL)")
cats <- c("RF//Renal function", "CPc//Child-Pugh")

eta_covariate(data, x = c(cont, cats), y = etas, tag_levels = "A")

eta_covariate(data, cont, y = etas)
eta_covariate(data, cont, y = etas, transpose = TRUE)

eta_covariate_list(data, x = cats, y = etas)
eta_covariate_list(data, x = cats, y = etas, transpose = TRUE)


metrumresearchgroup/pmplots documentation built on Oct. 15, 2024, noon