It seems in the most recent update to ggplot2, there is now a warning thrown if the number of aesthetic attributes doesn't match the number of data rows. This warning now gets generated when add_risktable() is used. The error is most easily confirmed in the current documentation page:
Below is a quick reproducible example, so long as the calling environment is using ggplot2 version 3.5.0.
packageVersion("ggplot2")
library(ggsurvfit)
result <- survfit2(Surv(time, status) ~ sex, data = df_lung) |>
ggsurvfit() +
add_risktable()
result
> packageVersion("ggplot2")
[1] ‘3.5.0’
Warning messages:
1: In ggplot2::geom_blank() :
All aesthetics have length 1, but the data has 208 rows.
ℹ Did you mean to use `annotate()`?
2: In ggplot2::geom_blank() :
All aesthetics have length 1, but the data has 208 rows.
ℹ Did you mean to use `annotate()`?
3: In ggplot2::geom_blank() :
All aesthetics have length 1, but the data has 208 rows.
ℹ Did you mean to use `annotate()`?
It seems in the most recent update to ggplot2, there is now a warning thrown if the number of aesthetic attributes doesn't match the number of data rows. This warning now gets generated when add_risktable() is used. The error is most easily confirmed in the current documentation page:
https://www.danieldsjoberg.com/ggsurvfit/reference/add_risktable.html
Below is a quick reproducible example, so long as the calling environment is using ggplot2 version 3.5.0.