Plot a dependent variable versus time
plot_dvtime(
data,
dv_var = c(DV = "DV"),
time_vars = c(TIME = "TIME", NTIME = "NTIME"),
timeu = "hours",
col_var = NULL,
grp_var = "ID",
loq = NULL,
loq_method = 0,
cent = "mean",
obs_dv = TRUE,
grp_dv = FALSE,
dosenorm = FALSE,
cfb = FALSE,
ylab = "Concentration",
log_y = FALSE,
show_caption = TRUE,
n_breaks = 8
)
Input dataset. Must contain the variables: "ID"
, "DV"
"MDV"
.
Character string of the dependent variable. Default is "DV"
.
Names of actual and nominal time variables. Must be named character vector.
Defaults are "TIME"
and "NTIME"
.
Character string specifying units for the time variable.
Passed to breaks_time
and assigned to default x-axis label.
Options include:
"hours" (default)
"days"
"weeks"
"months"
Character string of the name of the variable to map to the color aesthetic.
Character string of the variable to map to the group aesthetic. Default is "ID"
Numeric value of the lower limit of quantification (LLOQ) for the assay.
Must be coercible to a numeric if specified. Can be NULL
if variable LLOQ
is present in data
Specifying this argument implies that DV
is missing in data
where < LLOQ.
Method for handling data below the lower limit of quantification (BLQ) in the plot.
Options are:
+ 0
: No handling. Plot input dataset DV
vs TIME
as is. (default)
+ 1
: Impute all BLQ data at TIME
<= 0 to 0 and all BLQ data at TIME
> 0 to 1/2 x loq
.
Useful for plotting concentration-time data with some data BLQ on the linear scale
+ 2
: Impute all BLQ data at TIME
<= 0 to 1/2 x loq
and all BLQ data at TIME
> 0 to 1/2 x loq
.
Useful for plotting concentration-time data with some data BLQ on the log scale where 0 cannot be displayed
Character string specifying the central tendency measure to plot. Options are:
Mean only: "mean"
(default)
Mean +/- Standard Deviation: "mean_sdl"
Median only: "median"
Median +/- Interquartile Range: median_iqr
None: "none"
Logical indicating if observed data points should be shown. Default is TRUE
.
Logical indicating if observed data points should be connected within a group (i.e., spaghetti plot).
Default is FALSE
.
logical indicating if observed data points should be dose normalized. Default is FALSE
,
Requires variable DOSE
to be present in data
Logical indicating if dependent variable is a change from baseline.
Plots a reference line at y = 0. Default is FALSE
.
Character string specifing the y-axis label: Default is "Concentration"
.
Logical indicator for log10 transformation of the y-axis.
Logical indicating if a caption should be show describing the data plotted
Number of breaks requested for x-axis. Default is 5.
A ggplot2 plot object
data <- dplyr::mutate(data_sad, Dose = factor(DOSE))
plot <- plot_dvtime(data, dv_var = c(DV = "ODV"), cent = "median", col_var = "Dose")
#> Warning: The `fun.y` argument of `stat_summary()` is deprecated as of ggplot2 3.3.0.
#> ℹ Please use the `fun` argument instead.
#> ℹ The deprecated feature was likely used in the pmxhelpr package.
#> Please report the issue at <https://github.com/ryancrass/pmxhelpr/issues>.
plot
#> Warning: Removed 205 rows containing non-finite outside the scale range
#> (`stat_summary()`).
#> Warning: Removed 205 rows containing non-finite outside the scale range
#> (`stat_summary()`).
#> Warning: Removed 205 rows containing missing values or values outside the scale range
#> (`geom_point()`).