我正在使用 survminer 生成具有 2 条生存曲线的生存曲线,一条用于在手术期间接受 4 个包装红细胞 (PRBC) 单位的患者,另一种用于接受超过 4 个 PRBC 单位的患者。不幸的是,我无法使用“表达式”或“bquote”函数将正确的“<=”符号插入到图例中。
我已经阅读了有关此主题的先前帖子,但是我能够使用 expression() 和 bquote() 找到的指导似乎并没有正常工作。
library(survival)
library(coxed)
library(survminer)
simdata <- sim.survdata(N=300, T=100, num.data.frames=1, xvars = 1)
d <- simdata$data
d$Xfactor <- ifelse(d$X <= 0.3, 1, 0)
# the code chunks below do not seem to work because of the legends
ggsurvplot(
fit = survfit(Surv(d$y, event = d$failed) ~ d$Xfactor, data = d),
xlab = "Years",
ylab = "Overall survival probability",
main = "Overall survival",
legend.labs = c(bquote(<= ~ "4 Units"),"> 4 Units"))
ggsurvplot(
fit = survfit(Surv(d$y, event = d$failed) ~ d$Xfactor, data = d),
xlab = "Years",
ylab = "Overall survival probability",
main = "Overall survival",
legend.labs = c(bquote("" ~ <= ~ "4 Units"),"> 4 Units"))
ggsurvplot(
fit = survfit(Surv(d$y, event = d$failed) ~ d$Xfactor, data = d),
xlab = "Years",
ylab = "Overall survival probability",
main = "Overall survival",
legend.labs = c(expression("",<=,"4 Units"),"> 4 Units"))
ggsurvplot(
fit = survfit(Surv(d$y, event = d$failed) ~ d$Xfactor, data = d),
xlab = "Years",
ylab = "Overall survival probability",
main = "Overall survival",
legend.labs = c(expression(<=,"4 Units"),"> 4 Units"))
ggsurvplot(
fit = survfit(Surv(d$y, event = d$failed) ~ d$Xfactor, data = d),
xlab = "Years",
ylab = "Overall survival probability",
main = "Overall survival",
legend.labs = c(expression(<= "4 Units"),"> 4 Units"))