followup.time | R Documentation |
Computes the total or maximum follow-up time for each subject in a panel data structure, accounting for observation endpoints like death, loss to follow-up, or study conclusion.
followup.time(
dat,
id.name = "id",
t1.name = "t1",
t2.name = "t2",
followup.name = "followup.time",
calculate.as = "total",
append.to.data = FALSE
)
dat |
A data.frame structured as panel data. |
id.name |
The character name of the identifying variable within dat, used to track subjects across multiple rows. |
t1.name |
The character name of the time variable within dat representing the start (left endpoint) of observation intervals. |
t2.name |
The character name of the time variable within dat representing the end (right endpoint) of observation intervals. |
followup.name |
The character name for the new variable to display the calculated follow-up time for each subject. |
calculate.as |
A character value specifying the calculation method for follow-up time: "max" for the maximum observed time point for each subject, or "total" for the total observed time across all records for each subject (default). Note: "max" and "total" yield the same result when records start at time 0, have no gaps, and don't overlap. |
append.to.data |
A logical indicating whether to append the calculated follow-up time as a new column to the original data.frame (TRUE), or return it as a separate data frame (FALSE, default). |
Returns a modified version of the input data frame or a new data frame based on the append.to.data parameter. If append.to.data is TRUE, the original data frame is returned with an additional column named as specified by followup.name, containing the calculated follow-up times for each subject. If FALSE, a new data frame is returned containing the id.name and the calculated follow-up times under the followup.name column. This functionality is essential for analyses that require understanding the duration of subject participation or observation within the study period.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.