|
24 | 24 | #' @param design Data design for reactive design data , Default: NULL
|
25 | 25 | #' @param subs = NULL,
|
26 | 26 | #' @param table logical: Create a table graphic below the K-M plot, indicating at-risk numbers?
|
| 27 | +#' @param table.censor logical: Add numbers of censored in table graphic |
27 | 28 | #' @param label.nrisk Numbers at risk label. Default = "Numbers at risk"
|
28 | 29 | #' @param size.label.nrisk Font size of label.nrisk. Default = 10
|
29 | 30 | #' @param cut.landmark cut-off for landmark analysis, Default = NULL
|
@@ -80,6 +81,7 @@ svyjskm <- function(sfit,
|
80 | 81 | design = NULL,
|
81 | 82 | subs = NULL,
|
82 | 83 | table = F,
|
| 84 | + table.censor = F, |
83 | 85 | label.nrisk = "Numbers at risk",
|
84 | 86 | size.label.nrisk = 10,
|
85 | 87 | cut.landmark = NULL,
|
@@ -656,7 +658,16 @@ svyjskm <- function(sfit,
|
656 | 658 | time = summary(sfit2, times = times, extend = TRUE)$time[subs3],
|
657 | 659 | n.risk = summary(sfit2, times = times, extend = TRUE)$n.risk[subs3]
|
658 | 660 | )
|
659 |
| - |
| 661 | + if(table.censor){ |
| 662 | + risk.data <- data.frame( |
| 663 | + strata = Factor, |
| 664 | + time = summary(sfit2, times = times, extend = TRUE)$time[subs3], |
| 665 | + n.risk = summary(sfit2, times = times, extend = TRUE)$n.risk[subs3], |
| 666 | + n.censor = summary(sfit2, times = times, extend = TRUE)$n.censor[subs3] |
| 667 | + ) |
| 668 | + risk.data$n.risk <- paste0(risk.data$n.risk, " (", risk.data$n.censor, ")") |
| 669 | + risk.data$n.censor <- NULL |
| 670 | + } |
660 | 671 |
|
661 | 672 | risk.data$strata <- factor(risk.data$strata, levels = rev(levels(risk.data$strata)))
|
662 | 673 |
|
|
0 commit comments