我想创建一个网格/分面图以查看我的数据中几个组的累积发病率。于是,我开始与如何在R中绘制网格/小平面样式中的累积发生率图?
library(rms)
library(dplyr)
data(colon)
fit1 <- npsurv(Surv(time, status) ~ 1, data = colon %>% filter(rx=="Obs"))
survplot(fit1, fun = function(x) 1-x)
fit2 <- npsurv(Surv(time, status) ~ 1, data = colon %>% filter(rx=="Lev"))
survplot(fit2, fun = function(x) 1-x)
fit3 <- npsurv(Surv(time, status) ~ 1, data = colon %>% filter(rx=="Lev+5FU"))
survplot(fit3, fun = function(x) 1-x)
然后我被卡住把三个地块一起显示在顶部每个区组的名称。我不喜欢mfrow
或mfcol
解决方案。有人可以解释如何使用lattice
或ggplot2
来做到这一点?
谢谢你的帮助!