使用 ggsurplot 时匹配错误(x,table,不匹配 =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、survival、survminer、ggplot2、gridExtra。
我的数据 table 上有 运行 这段代码,没有任何问题。但是今天当我 运行 代码时,我遇到了上述错误问题。我不认为这是由于我的数据输入造成的。
ggsurvplot(fit, risk.table=TRUE)
有趣的是,当我 运行 上面的代码时,我用 table 得到了正确的 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")
我的密码是
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、survival、survminer、ggplot2、gridExtra。 我的数据 table 上有 运行 这段代码,没有任何问题。但是今天当我 运行 代码时,我遇到了上述错误问题。我不认为这是由于我的数据输入造成的。
ggsurvplot(fit, risk.table=TRUE)
有趣的是,当我 运行 上面的代码时,我用 table 得到了正确的 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")