我想在同一张图上绘制许多来自不同研究的残差对象。
研究时间长短不一,但我想不出任何其他主要差异。
下面是我的代码:
#Fitting ambristentan data
ambri_surv_fit <- survfit(Surv(event_time, censor)~1, data=ambri_mono)
#Fitting tadalafil data
tada_surv_fit <- survfit(Surv(event_time, censor)~1, data=tada_mono)
#Fitting macitentan data
maci_surv_fit <- survfit(Surv(event_time, censor)~1, data=maci_mono)
#Fitting maci_control mono data
maci_control_mono_surv_fit <- survfit(Surv(event_time, censor)~1, data=maci_control_mono)
surv_fit_list <- list(ambri_surv_fit,
tada_surv_fit,
maci_surv_fit,
maci_control_mono_surv_fit)
ggsurvplot(surv_fit_list, combine=TRUE)
我得到的错误:
Error in names(fit) <- fitnames :
'names' attribute [2828] must be the same length as the vector [4]
我希望它看起来如何:
答案 0 :(得分:0)
结果是您必须命名列表:
surv_fit_list <- list("ambirsentan monotherapy" =ambri_surv_fit,
"tadalafil monotherapy" = tada_surv_fit,
"macitentan monotherapy" = maci_surv_fit,
"macitentan control monotherapy" = maci_control_mono_surv_fit)