Transforms data from long format to counting process format.
Usage
long2cp(data, id, time, status = NULL, drop = FALSE)
Value
A data frame in counting process format.
Arguments
data
A data frame with relevant columns.
id
A character string of the identification column name in data.
time
A character string of the time column name in data.
status
A character string of the status column in data either event or state.
drop
Logical indicator for whether any id groups with insufficient rows should be dropped from the output. Default is FALSE.
Details
The transition is primarily done by shifting the column supplied to the time argument into two new columns for a column-wise time definition and adjusting rows accordingly. Column names supplied to the status arguement are assumed to ocurr at the right endpoint so the first value for each id of the input is dropped. All other time-varying columns are assumed to ocurr at the left endpoint so the last value for each id of the input is dropped. The drop argument can be used for any id levels that may only have one row where a two column time data set might not suit them. Since there is not any useful gained from going from one time to the same time, it may be useful to just drop those id levels altogether.