我正在尝试使用 survminer 通过 ggadjustedcurves() 创建调整后的生存曲线。
我的代码如下:
adjustedcurve <- coxph(Surv(time_DeathTxCensor, deadORtx==1) ~ strata(natADI_quart) + sex + FVCpctPre + DLCOpctPre + smokeHx + age_dx, data=ADI, id=ID)
ggadjustedcurves(adjustedcurve,
variable="natADI_quart",
method="conditional",
data=ADI)
我收到错误消息:
if (xi > xj) 1L else -1L 中出错:需要 TRUE/FALSE 时缺少值
这也是我的回溯:
16. .gt(structure(c(1L, 3L, 2L, 4L), .Label = c("1", "2", "3", "4" ), class = "factor"), 1L, 2L)
15. rank(x, ties.method = "min", na.last = "keep")
14. as.vector(rank(x, ties.method = "min", na.last = "keep"))
13. xtfrm.default(x)
12. xtfrm(x)
11. as.vector(xtfrm(x))
10. FUN(X[[i]], ...)
9. lapply(z, function(x) if (is.object(x)) as.vector(xtfrm(x)) else x)
8. order(x, na.last = na.last, decreasing = decreasing)
7. `[.tbl_df`(x, order(x, na.last = na.last, decreasing = decreasing))
6. x[order(x, na.last = na.last, decreasing = decreasing)]
5. sort.default(unique(data[, variable]))
4. sort(unique(data[, variable]))
3. ggadjustedcurves.conditional(data, fit, variable, size = size)
2. surv_adjustedcurves(fit = fit, variable = variable, data = data, reference = reference, method = method, size = size, ...)
1. ggadjustedcurves(adjustedcurve, data = ADI)
我不知道这意味着什么或如何解决它。非常感谢任何帮助:)