如何解决使用ggsurplot时匹配错误x,表,不匹配=0L
我的代码是
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、生存、survmminer、ggplot2、gridExtra。 我已经在我的数据表上运行了这段代码,没有任何问题。但是今天当我运行代码时,我遇到了上述错误问题。我不认为这是由于我的数据输入造成的。
ggsurvplot(fit,risk.table=TRUE)
有趣的是,当我运行上面的代码时,我得到了正确的 KM 图和表格,但我也收到了一条警告消息
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")
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。