Description Usage Arguments Value References Examples
createSurvivalFrame Create a data frame suitable for plotting survival curves from a 'survfit' object.
1 | createSurvivalFrame(Sfit)
|
Sfit |
A object from survfit |
A dataframe suitable for plotting survival curves
code written by Ramon Saccilotto
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | s1 <- survfit(Surv(as.numeric(D$surdate), D$censor_m) ~ D$isup_m, data = D)
f.frame<-createSurvivalFrame(s1)
ggplot(data=f.frame, aes(col = strata, group = strata)) + geom_step(aes(x = time, y = surv), direction = "hv", size = 1.2) +
geom_point(data = subset(f.frame, n.censor == 1), aes(x = time, y = surv), shape = "|", cex = 7) + theme_bw() +
scale_color_discrete(name=" ",
breaks = c("D$isup_m=1", "D$isup_m=2","D$isup_m=3", "D$isup_m=4"),
labels = c("1", "2", "3", "4")) +
scale_x_discrete(breaks = c(seq(0, 30, by=5)), labels = c(seq(0, 30, by=5))) +
coord_cartesian(ylim = c(0, 1.05)) +
theme(axis.text = element_text(size = 18),
axis.title = element_text(size = 16,face = "bold"),
plot.title = element_text(lineheight = .12, face = "bold", size = 15),
legend.text = element_text(size = 18)) +
labs(x = "
Time (Month)", y = "Survival
",size = rel(2))+
ggtitle("(a) ISUP Grouping
")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.