My code is
fit <- survfit(Surv(OS, DEATH) ~ high, data=datf1)
no error:
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
My code that generates the error
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
My libraries: dplyr, survival, survminer, ggplot2, gridExtra. I have run this code on my data table with no issues. But today when I run the code I am having the above error issue. I do not believe it's due to my data input.
ggsurvplot(fit, risk.table=TRUE)
Interestingly when I run the above code, I get the correct KM plot with table, but I also get a warning message
Vectorized input to 'element_text()' is not officially supported.
Results may be unexpected or may change in future versions of ggplot2.
Any assistance in solving this would be greatly appreciated.
I think it's due to the variable cols
. Can you try if this works:
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")