Home > Net >  How can I add a string of Length One with multiple titles?
How can I add a string of Length One with multiple titles?

Time:11-11

Current Code:

survfit(Surv(time, DEATH_EVENT) ~ 1, data = HF %>% filter(age <= 70)) %>% 
  tbl_survfit(
    times = c(150,200),
    label_header = "**150 Day survival (95% CI)**"
  )

Output:

How can I add two separate titles to indicate survival times at 150 & 200?

The following code gives me an error:

survfit(Surv(time, DEATH_EVENT) ~ 1, data = HF %>% filter(age <= 70)) %>% 
  tbl_survfit(
    times = c(150,200),
    label_header = c("**150 Day survival (95% CI)**", "**200 Day survival (95% CI)**")
  )

Error: statistic= and label_header= arguments must be strings of length one.

CodePudding user response:

Take a look at the function's help file. The first example solves this issue: you need to use glue-syntax to dynamically insert the day number into the headers.

enter image description here

  • Related