Applies time duration truncation limits to create columns for Cox model
Source:R/Utility.R
Check_Trunc.Rd
Check_Trunc
creates columns to use for truncation
Arguments
- df
a data.table containing the columns of interest
- ce
columns to check for truncation, (t0, t1, event)
- verbose
integer valued 0-4 controlling what information is printed to the terminal. Each level includes the lower levels. 0: silent, 1: errors printed, 2: warnings printed, 3: notes printed, 4: debug information printed. Errors are situations that stop the regression, warnings are situations that assume default values that the user might not have intended, notes provide information on regression progress, and debug prints out C++ progress and intermediate results. The default level is 2 and True/False is converted to 3/0.
See also
Other Data Cleaning Functions:
Check_Dupe_Columns()
,
Check_Verbose()
,
Convert_Model_Eq()
,
Correct_Formula_Order()
,
Date_Shift()
,
Def_Control()
,
Def_Control_Guess()
,
Def_model_control()
,
Def_modelform_fix()
,
Event_Count_Gen()
,
Event_Time_Gen()
,
Joint_Multiple_Events()
,
Replace_Missing()
,
Time_Since()
,
factorize()
,
factorize_par()
,
gen_time_dep()
,
interact_them()
Examples
library(data.table)
df <- data.table::data.table(
"UserID" = c(112, 114, 213, 214, 115, 116, 117),
"Starting_Age" = c(18, 20, 18, 19, 21, 20, 18),
"Ending_Age" = c(30, 45, 57, 47, 36, 60, 55),
"Cancer_Status" = c(0, 0, 1, 0, 1, 0, 0)
)
# For the interval case
time1 <- "Starting_Age"
time2 <- "Ending_Age"
ce <- c("%trunc%", "Ending_Age")
val <- Check_Trunc(df, ce)
df <- val$df
ce <- val$ce