renumber_time_id: Renumber the time ID per case (i.e. Tumor sequence)

View source: R/renumber_time_id.R

renumber_time_idR Documentation

Renumber the time ID per case (i.e. Tumor sequence)

Description

Renumber the time ID per case (i.e. Tumor sequence)

Usage

renumber_time_id(
  df,
  new_time_id_var,
  dattype = NULL,
  case_id_var = NULL,
  time_id_var = NULL,
  diagdat_var = NULL,
  timevar_max = Inf
)

Arguments

df

dataframe

new_time_id_var

Name of the newly calculated variable for time_id. Required.

dattype

can be "zfkd" or "seer" or NULL. Will set default variable names if dattype is "seer" or "zfkd". Default is NULL.

case_id_var

String with name of ID variable indicating same patient. E.g. case_id_var="PUBCSNUM" for SEER data.

time_id_var

String with name of variable that indicates diagnosis per patient. E.g. time_id_var="SEQ_NUM" for SEER data.

diagdat_var

String with name of variable that indicates date of diagnosis per event. E.g. diagdat_var="t_datediag" for SEER data.

timevar_max

Numeric; default Inf. Maximum number of cases per id. All tumors > timevar_max will be deleted.

Value

df

Examples


data(us_second_cancer)
us_second_cancer %>%
 #only select first 10000 rows so example runs faster
 dplyr::slice(1:10000) %>%
 msSPChelpR::renumber_time_id(new_time_id_var = "t_tumid",
                             dattype = "seer",
                             case_id_var = "fake_id")
                             

marianschmidt/msSPChelpR documentation built on Feb. 1, 2024, 6:45 a.m.