Skip to contents

This function generates a list of ggplots for PK concentration-time profiles.

Usage

pkcg01(
  adpc = data(),
  xvar = "AFRLT",
  yvar = "AVAL",
  xvar_unit = "RRLTU",
  yvar_unit = "AVALU",
  color_var = NULL,
  color_var_label = NULL,
  xbreaks_var = "NFRLT",
  xbreaks_mindist = 0.5,
  xmin = NA,
  xmax = NA,
  ymin = NA,
  ymax = NA,
  xlab = paste0(xvar, " [", unique(adpc[[xvar_unit]]), "]"),
  ylab = paste0(yvar, " [", unique(adpc[[yvar_unit]]), "]"),
  title = NULL,
  subtitle = NULL,
  footnote = NULL,
  plotgroup_vars = c("ROUTE", "PCSPEC", "PARAM", "USUBJID"),
  plotgroup_names = list(ROUTE = "Route", PCSPEC = "Specimen", PARAM = "Analyte", USUBJID
    = "Subject ID"),
  scale = c("LIN", "LOG", "SBS")[1],
  studyid = "STUDYID",
  trt_var = "TRT01A"
)

Arguments

adpc

A data frame containing the data.

xvar

A character string of the variable name for the x-axis.

yvar

A character string of the variable name for the y-axis.

xvar_unit

A character string of the unit for the x-axis variable.

yvar_unit

A character string of the unit for the y-axis variable.

color_var

A character string of the variable name for the color.

color_var_label

A character string of the color label.

xbreaks_var

A character string of the x-axis breaks.

xmin

A numeric value specifying the minimum x-axis limit.

xmax

A numeric value specifying the maximum x-axis limit.

ymin

A numeric value for the minimum y-axis limit.

ymax

A numeric value for the maximum y-axis limit.

xlab

Character for x-axis label. Defaults: xvar label & xvar_unit.

ylab

Character for y-axis label. Defaults: yvar label & yvar_unit.

footnote

A character string of a manual footnote for the plot.

plotgroup_vars

A character vector of the variables to group data.

plotgroup_names

A character vector of the grouping variable names.

studyid

A character string specifying the study ID variable.

trt_var

A character string specifying the treatment variable.

options

A list of additional options (e.g., display scale).

Value

A list of ggplot objects for each unique group.

Author

Gerardo Rodriguez magic numbers for footnote position and margin, work in app up to 4 lines NOTE: might require some fine tuning down the line, looks fine now

Examples

if (FALSE) { # \dontrun{
  adpc <- read.csv("inst/shiny/data/DummyRO_ADNCA.csv")
  attr(adpc[["AFRLT"]], "label") <- "Actual time from first dose"
  attr(adpc[["AVAL"]], "label") <- "Analysis val"

  plots_lin <- pckg01(adpc = adpc, xmax = 1)
  plots_log <- pckg01(adpc = adpc, color_var = "USUBJID", scale = "LOG")
  plots_sbs <- pckg01(
    adpc = adpc,
    color_var = "USUBJID",
    xbreaks_var = "NFRLT",
    xmin = 100,
    xmax = 1000,
    scale = "SBS"
  )
} # }