Skip to contents

The Data Exploration page's individual plots: one panel per subject, with optional dose bars, LLOQ line, sorting and highlighting. Draws one page, or writes all pages to a PDF file.

Usage

mvp_ind_plot(
  data,
  x,
  y,
  page = 1,
  nrow = 4,
  ncol = 4,
  ids = NULL,
  sort_by = NULL,
  color = NULL,
  dose = NULL,
  dose_units = "",
  lloq = NULL,
  same_scale = FALSE,
  highlight = NULL,
  highlight_values = NULL,
  lm = FALSE,
  log_x = FALSE,
  log_y = FALSE,
  cmt = NULL,
  title = NULL,
  label_size = 3,
  file = NULL,
  width = 16,
  height = 9
)

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.

page

Page to draw.

nrow, ncol

Panels per page (rows and columns).

ids

Optional subject IDs to show (instead of a page).

sort_by

Optional column(s) to sort and label the panels by.

color

Optional column to colour by.

dose

Optional dose column for dose bars (needs EVID in the data).

dose_units

Text after the dose labels, e.g. " mg".

lloq

Optional LLOQ column, drawn as a dashed line.

same_scale

Use the same axes on every panel.

highlight, highlight_values

Optional column, and its values, whose records are highlighted.

lm

Add a linear regression line and its equation.

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).

file

Optional path of a PDF file: all pages are written to it, as the app's "Download All Pages"; nothing is written by default.

width, height

Page size of the PDF, in inches.

Value

A ggplot object (the page), or, with file, invisibly the path.

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))
mvp_ind_plot(d, x = "TIME", y = "DV", nrow = 1, ncol = 3)