Times relative to an event (typically dosing)
Arguments
- time_event
A vector of times for events
- time_obs
A vector of times for observations
- units
Passed to
base::as.numeric.difftime()
Value
A data.frame with columns for:
event_number_beforeThe index of
time_event
that is the last one beforetime_obs
orNA
if none are before.event_number_afterThe index of
time_event
that is the first one aftertime_obs
orNA
if none are after.time_beforeThe minimum time that the current
time_obs
is before atime_event
, 0 if at least onetime_obs == time_event
.time_afterThe minimum time that the current
time_obs
is after atime_event
, 0 if at least onetime_obs == time_event
.time_after_firstThe time after the first event (may be negative or positive).
time_after
and time_before
are calculated if they are at the same time as
a dose, they equal zero, and otherwise, they are calculated relative to the
dose number in the event_number_*
columns.