Replaces single row repeated dosing events by multiple lines, then reorders rows with respect to ID and TIME. If the row order is different, you have to reorder the output manually.

NMexpandDoses(
  data,
  col.time = "TIME",
  col.id = "ID",
  col.evid = "EVID",
  track.expand = FALSE,
  subset.dos,
  quiet = FALSE,
  as.fun
)

Arguments

data

The data set to expand

col.time

The name of the column holding the time on which time since previous dose will be based. This is typically actual or nominal time since first dose.

col.id

The subject identifier. All new columns will be derived within unique values of this column.

col.evid

The name of the event ID column. This must exist in data. Default is EVID.

track.expand

Keep track of what rows were in data originally and which ones are added by NMexpandDoses by including a column called nmexpand? nmexpand will be TRUE if the row is "generated" by NMexpandDoses.

subset.dos

A string that will be evaluated as a custom expression to identify relevant events.

quiet

Suppress messages back to user (default is FALSE)

as.fun

The default is to return data as a data.frame. Pass a function (say tibble::as_tibble) in as.fun to convert to something else. If data.tables are wanted, use as.fun="data.table". The default can be configured using NMdataConf.

Value

A data set with at least as many rows as data. If doses are found to expand, these will be added.