View source: R/timeinterval.h.R
timeinterval | R Documentation |
Calculates time intervals between dates or from pre-calculated values. Time intervals form the basis of person-time follow-up calculations in survival analysis. Person-time follows the accumulated time that participants contribute to a study while being at risk for the event of interest, accounting for varying entry times and censoring. Person-time is typically expressed in person-days, person-months, or person-years depending on the study duration and outcome frequency.
timeinterval(
data,
dx_date,
fu_date,
time_format = "ymd",
output_unit = "months",
use_landmark = FALSE,
landmark_time = 3,
add_times = TRUE
)
data |
The data as a data frame. |
dx_date |
Column containing start dates |
fu_date |
Column containing end dates |
time_format |
. |
output_unit |
. |
use_landmark |
. |
landmark_time |
. |
add_times |
. |
A results object containing:
results$todo | a html | ||||
results$personTimeInfo | a html | ||||
results$summary | a html | ||||
results$calculated_time | an output | ||||
# Calculate time intervals for person-time analysis:
# timeinterval(
# data = study_data,
# dx_date = "diagnosis_date",
# fu_date = "followup_date",
# output_unit = "months"
# )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.