tad: Calculate time after dose (TAD)

View source: R/tad.R

tadR Documentation

Calculate time after dose (TAD)

Description

tad() computes the time after dose, adding a new column to a data frame.

Usage

tad(data, cond = "", expand = FALSE)

Arguments

data

A data frame or data frame extension in NONMEM format..

cond

A filtering condition that specifies for which rows to calculate TAD, as a string (optional).

expand

Whether to expand the ADDL column in the result.

Details

tad() assumes NONMEM-formatted data. It will expand the ADDL column internally, but will return the data in its non-expanded form unless expand is set to TRUE.

Expressions in ... are used to determine under what conditions a row of data should count as a "dose" for calculating time after dose. This is especially useful if there is more than one type of dose event, and TAD should only apply to one of them. For example, suppose the DV column of data contains concentrations of a drug X. If a flag column "Y_FLAG" exists to indicate that a drug Y is given, as opposed to X, passing Y_FLAG = 0 to ... will ensure that TAD is only calculated with respect to drug X dosing events.

Value

A tibble::tibble() with an appended column, TAD, containing the time after since the most recent dose for each observation record.

Author(s)

Sandy Floren

Examples

# Basic TAD calculation
tad(pk_example)

# compute TAD only for even ID numbers, and return in expanded form
tad(pk_example, "ID %% 2 == 0", expand = TRUE)


saviclab/savictools documentation built on Dec. 7, 2023, 11:56 p.m.