Skip to contents

The Data Exploration page's general plot: a scatter/line plot of y against x for all subjects, with optional colouring, facets, median line, regression line, smoother, box plots or quantile bins of x.

Usage

mvp_data_plot(
  data,
  x,
  y,
  color = NULL,
  facet = NULL,
  median_line = FALSE,
  median_by = NULL,
  boxplot = FALSE,
  quantize = 0,
  lm = FALSE,
  smoother = FALSE,
  log_x = FALSE,
  log_y = FALSE,
  cmt = NULL,
  title = NULL,
  label_size = 3
)

Arguments

data

A data frame (e.g. from mvp_data()) with an ID column, or the path of a .csv (or tab-delimited .txt) file. Dosing rows (EVID >= 1) are left out.

x, y

Column names for the axes.

color

Optional column to colour by.

facet

Optional column(s) to facet by.

median_line

Add a median line over binned x; median_by splits it by a column.

median_by

Optional column to split the median line by.

boxplot

Box plots of y per x value (one row per subject).

quantize

Number of quantile bins for a continuous x (0 = off); shown as box plots.

lm

Add a linear regression line and its equation.

smoother

Add a smoother.

log_x, log_y

Log scale for the axes.

cmt

Optional compartment(s) to keep (CMT column).

title

Optional plot title.

label_size

Size of count and equation labels (0 hides them).

Value

A ggplot object.

See also

Examples

d <- data.frame(ID = rep(1:3, each = 4), TIME = rep(c(0, 1, 2, 4), 3),
                DV = c(0, 5, 4, 2, 0, 6, 5, 3, 0, 4, 3, 1), DOSE = rep(c(10, 20, 30), each = 4))
mvp_data_plot(d, x = "TIME", y = "DV", color = "DOSE")