hputter / mstate

https://hputter.github.io/mstate/
7 stars 5 forks source link

plot.Cuminc with Base R - arguments not passed to plot.survfit #10

Closed harisf closed 3 years ago

harisf commented 3 years ago

Arguments like lty or xlab don't get passed along to plot.survfit in the default case when use.ggplot = FALSE.

Example

library(mstate)

data("aidssi")

cum_incid <- Cuminc(time = "time", status = "status", data = aidssi)
plot(x = cum_incid, use.ggplot = FALSE, conf.type = "none", 
lty = 1:2, xlab = "Time") # Plots both lines with lty = 1, and no x-axis label
edbonneville commented 3 years ago

Hi @harisf - thank you for bringing this up! This is now fixed the relsurv development branch, which can be downloaded/installed using devtools::install_github("hputter/mstate", ref = "relsurv"). Otherwise, if you would like a quick-fix with your currently installed version, you can do:

library(mstate)

data("aidssi")

cum_incid <- Cuminc(time = "time", status = "status", data = aidssi)
plot(x = attr(cum_incid, "survfit"), lty = 1:2, xlab = "Time")

Also note that conf.type does not get passed down to plot.survfit(), but conf.int does (where conf.int = NULL will omit the confidence intervals from the plot).