繁体   English   中英

使用ggsurplot时匹配错误(x,表,不匹配= 0L

[英]Error in match(x, table, non match =0L when using ggsurplot

我的代码是

fit <- survfit(Surv(OS, DEATH) ~ high, data=datf1)

没有错误:

print(fit)
      n    events  median  0.95LCL 0.95UCL
C=1  106    30      62.6     62.2    65.1
C=2  190    51      63.3     62.1    64.3

我产生错误的代码

ggsurvplot(fit, pval=TRUE, conf.int=TRUE,
risk.table=TRUE, surv.median.line='hv', ylab='OS', break.x.by=5, palette=cols, 
title="P_01")
Error in match (x, table, nomatch=0L):
'match' requires vector arguments

我的图书馆:dplyr,生存,survminer,ggplot2,gridExtra。 我已经在我的数据表上运行了这段代码,没有任何问题。 但是今天当我运行代码时,我遇到了上述错误问题。 我不相信这是由于我的数据输入。

ggsurvplot(fit, risk.table=TRUE)

有趣的是,当我运行上面的代码时,我得到了正确的 KM plot 和表格,但我也收到了一条警告消息

Vectorized input to 'element_text()' is not officially supported. 
Results may be unexpected or may change in future versions of ggplot2.

解决此问题的任何帮助将不胜感激。

我认为这是由于变量cols 你可以试试这是否有效:

ggsurvplot(fit, pval=TRUE, conf.int=TRUE,
           risk.table=TRUE, surv.median.line='hv', ylab='OS', break.x.by=5, palette = c("blue", "red"), 
           title="P_01")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM