derive_followup_time: Calculate followup_time, the number of days from index to...

View source: R/derive_functions.R View source: R/derive_followup_time.R

derive_followup_timeR Documentation

Calculate followup_time, the number of days from index to follow up in days

Description

Calculate followup_time, the number of days from index to follow up in days

Calculate followup_time, the number of days from index to follow up in days

Usage

derive_followup_time(
  data,
  index_date = "index_date",
  followup_date = "followup_date",
  followup_time_rename = "followup_days"
)

derive_followup_time(
  data,
  index_date = "index_date",
  followup_date = "followup_date",
  followup_time_rename = "followup_days"
)

Arguments

data

dataframe. A one-row-per-patient dataframe.

index_date

character. The name of a column in data indicating index dates.

followup_date

character. The name of a column in data indicating follow up dates.

followup_time_rename

character. (Optional) Name of the resulting follow up days column.

Value

The cohort dataframe with new columns followup_days, followup_months, followup_years.

dataframe.

References

https://pumas.nasa.gov/examples/index.php?id=46

Examples


data <- cohort_raw %>%
  derive_followup_date(
    event_date = "dateofdeath",
    censor_date = "lastvisitdate"
  )

# Derive follow up time from index to follow up in days, months and years.

data %>%
  derive_followup_time(
    index_date = "lotstartdate",
    followup_date = "followup_date"
  )

ndphillips/iwillsurvive documentation built on June 4, 2024, 3 p.m.