This function is intended to create forest plots based upon a data.frame typically created by the make_gmr_data function. The output is a ggplot2 object.

make_forestplot(
  data,
  x,
  xmin,
  xmax,
  y,
  color,
  reference,
  label,
  facet,
  vline_primary = 1,
  vline_secondary = c(0.8, 1.25),
  xlb,
  ylb,
  title,
  n_label = "individual",
  fatten = 4,
  small_font = FALSE,
  is_facet_expression = NULL
)

Arguments

data

a data.frame; typically created using make_gmr_data

x, xmin, xmax, y

the mapping variables represented by geom_pointrange

color

the mapping variable providing the coloring information

reference

the mapping variable defining whether levels of the y variable are reference ones.

label

the mapping variable providing the information displaying on the secondary Y axis

facet

a single facetting variable (can be a vector of expression)

vline_primary, vline_secondary

the X-axis values for which a primary and secondary vertical lines are drawn

xlb, ylb, title

optional axis and plot titles (can be expressions)

n_label

a character value defining how individuals are defined in the abbreviation in the table footnote, that is, what is used in the definition of 'n' (eg, 'n, number of individuals'). By default, a 's' will be added to the entered value.

fatten

a scaling factor of the points defined by x

small_font

a logical value indicating whether a smaller font size should be used

is_facet_expression

a logical value indicating whether the levels of the facet variable are expression (TRUE) or character (FALSE) objects; if set to NULL, make_gmr_data tries to make an educated guess

Value

a ggplot2 plot object. See vignette('forest', package = 'ggcognigen') more details of the different design variants that can be created.

Examples

if (FALSE) { # \dontrun{
# Use expo dataset provided in the ggcognigen package

gmrs <- expo %>%
  make_gmr_data(
    x_var = c(CMAXSS, AUCSS, CMINSS),
    id_var = ID,
    by = DOSE,
    covariates = c(AGE, WTKG, BMI, SEXF, RFCAT, CPCAT),
    labels = c(
      expression('Age'~'(y)'),
      expression('Body'~'Weight'~'(kg)'),
      expression('Body'~'Mass'~'Index'~'(kg/'*m^2*')'),
      expression('Sex'),
      expression('Renal'~'Function'),
      expression('Hepatic'~'Function')
    ),
    ref_levels = c(2, 3, 2, 1, 1, 1),
    digits = 3,
    silent = TRUE
  )

make_forestplot(
  data = gmrs %>% dplyr::filter(x_var == "AUCSS"),
  x = gmr,
  xmin = gmr_lo,
  xmax = gmr_hi,
  y = value,
  color = by,
  label = gmr_n_label,
  facet = y_label,
  vline_primary = 1,
  vline_secondary = c(0.8, 1.25),
  xlb = 'Geometric Mean Ratio [90% confidence interval]',
  title = expression(C[trough]~'(nmol/L)'),
  fatten = 2,
  small_font = TRUE
) +
  scale_discrete_cognigen(n = 4, geom = 'point')
} # }