-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Description
Hi,
I am trying to run ggsurvplot, and this one's a little tricky for me to debug. I am attaching my Rdata here: ggsurvplot_debug.RData
# load RData object from google drive (attached above)
load('ggsurvplot_debug.RData')
# objects in RData file
> ls()
[1] "fit" "p" "surv_data"
- I only get the error when I set
risk.table = TRUEAND set the palette argument to a custom vector of colors (as shown below):
# use ggsurvplot to generate survival plot (basic arguments)
ggsurvplot(
fit,
palette = c("#ff4040",
"#bf9000",
"#00BFC4",
"#9fc5e8",
"#4363d8",
"#0000ff",
"#ffe135",
"#bf9000",
"#ffa500",
"#F8766D",
"#000000",
"#dcbeff",
"#C77CFF",
"#911eb4",
"#FF4DC5",
"#7CAE00"),
data = surv_data,
risk.table = T
)
# this is resulting in the following errors
Error in names(.cols) <- grp.levels :
'names' attribute [16] must be the same length as the vector [15]
- When I set
risk.table = FALSEalong with custom palette, it works:
# works without an error
ggsurvplot(
fit,
palette = c("#ff4040",
"#bf9000",
"#00BFC4",
"#9fc5e8",
"#4363d8",
"#0000ff",
"#ffe135",
"#bf9000",
"#ffa500",
"#F8766D",
"#000000",
"#dcbeff",
"#C77CFF",
"#911eb4",
"#FF4DC5",
"#7CAE00"),
data = surv_data,
risk.table = F
)
- When I set
risk.table = TRUEalong and don't assign a custom palette, it works:
# works without an error
ggsurvplot(
fit,
data = surv_data,
risk.table = T
)
Metadata
Metadata
Assignees
Labels
No labels