I am using the new package tidycmprsk and trying to plot cumulative incidence function of a dataset with about 800 observations. However, when I include more than 320 observations I receive the following error:
Error in if (any(is.na(df$time)) || any(is.na(df$time_chr)) || max(abs(df$time - :
missing value where TRUE/FALSE needed
In addition: Warning message:
In cuminc_matrix_to_df(., name = "estimate", times = times) :
NAs introduced by coercion
At first, I thought the problem was with the observation nr 320, but included this observation and reduced the number of included observations and I received no errors.
Any idea where the problem lies?
Thanks in forward and thanks Daniel and Teng for this great package.
This is my code:
cif <- tidycmprsk::cuminc(Surv(time, outcome) ~ strata, data = x1)
and here is a part of my data
x1 <- structure(list(strata = c("T2", "T1", "T3", "T2", "T4", "T1",
"T2", "T4", "T2", "T4", "T4", "T3", "T1", "T1", "T2", "T3"),
outcome = structure(c(1L, 1L, 1L, 2L, 3L, 3L, 1L, 2L, 1L,
2L, 2L, 2L, 1L, 1L, 1L, 1L), levels = c("Alive or censored",
"Death from oral cancer", "Death from other causes"), class = "factor"),
time = c(4.96986301369863, 9.4027397260274, 6.15068493150685,
1.51232876712329, 1.84383561643836, 8.94520547945205, 5.23561643835616,
1.65753424657534, 7.44109589041096, 0.583561643835616, 2.80547945205479,
12.6958904109589, 9.36986301369863, 6.3041095890411, 10.7342465753425,
6.87945205479452)), row.names = 310:325, class = "data.frame")