Skip to contents

Takes treatment timelines in long format (as produced by OR.txlines.timeline()) and converts them to wide format with one row per id and one set of start date, regimen, and event date columns per treatment line.

Usage

OR.txlines.wide(id, date, regimen, event, line)

Arguments

id

Vector of identifiers.

date

Numeric vector of dates (sorted within each id).

regimen

Comma-delimited string vector of active regimens at each date.

event

Logical vector indicating whether an event occurs at each date.

line

Numeric vector indicating treatment line at each date.

Value

A data frame in wide format with columns, where k indexes treatment lines:

id

Identifier.

date.startL(k)

Start date of line k.

regimenL(k)

Regimens in line k.

date.eventL(k)

Earliest event date (regardless of line label) after the start date of line k.