pharmaverse / ggsurvfit

http://www.danieldsjoberg.com/ggsurvfit/
Other
70 stars 19 forks source link

Allowing use of magrittr pipe in `survfit2()` #99

Closed ddsjoberg closed 1 year ago

ddsjoberg commented 1 year ago

What changes are proposed in this pull request?

If there is an GitHub issue associated with this pull request, please provide link. closes #93


Reviewer Checklist (if item does not apply, mark is as complete)

When the branch is ready to be merged into master:

shannonpileggi commented 1 year ago

the only thing i could find is that

library(ggsurvfit)
#> Loading required package: ggplot2

df_colon %>% 
  survfit2(Surv(.$time, .$status) ~ surg, data = .) %>% 
  ggsurvfit(size = 1) 

Created on 2022-10-03 by the reprex package (v2.0.1)

results in the time variable label not being passed through

ddsjoberg commented 1 year ago

Thanks for taking a look @shannonpileggi !!

ddsjoberg commented 1 year ago

I feel it would be worth adding an example and text in the survfit2 docstring to explain the current behaviour with pipes i.e. on line 64 add something like

df_lung %>% survfit2(Surv(time, status) ~ sex, data  = .) %>%
  summary(times = c(10, 20))

Thanks @bailliem ! I think because we're accounting for a non-standard use of the magrittr pipe (typically it's passed to the first argument), we don't need an example highlighting how to use it this way. Also, Hadley is prepping the purrr v1.0 release, and he's removed all %>% and replaced them with |>.

ddsjoberg commented 1 year ago

@SHAESEN2 let's address and PARAM changes in a separate PR