簡體   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