Skip to content

level percentages of finalfit.coxph #74

@corneliushennch

Description

@corneliushennch

Dear authors of finalfit,

before getting to my issue, I'd like to express a big thank you for creating this awesome package. I am using it extensively for a variety of analyses as it seamlessly integrates in my workflow that is heavily based on the tidyverse.
One thing that bothers me a little when reporting survival models is the fact that the percentages of the variable levels in the "all" column of the finalfit.coxph output are wrong as it's always (100.0). It would be awesome if you could implement the correct percentages for the factor levels in a future update.

library(finalfit)

explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "Surv(time, status)"

colon_s %>%
  finalfit(dependent, explanatory)
#>  Dependent: Surv(time, status)                     all
#>                            Age   <40 years  70 **(100.0)**
#>                                40-59 years 344 **(100.0)**
#>                                  60+ years 515 **(100.0)**
#>                            Sex      Female 445 **(100.0)**
#>                                       Male 484 **(100.0)**
#>                    Obstruction          No 732 **(100.0)**
#>                                        Yes 176 **(100.0)**
#>                    Perforation          No 902 **(100.0)**
#>                                        Yes  27 **(100.0)**
#>           HR (univariable)        HR (multivariable)
#>                          -                         -
#>  0.76 (0.53-1.09, p=0.132) 0.79 (0.55-1.13, p=0.196)
#>  0.93 (0.66-1.31, p=0.668) 0.98 (0.69-1.40, p=0.926)
#>                          -                         -
#>  1.01 (0.84-1.22, p=0.888) 1.02 (0.85-1.23, p=0.812)
#>                          -                         -
#>  1.29 (1.03-1.62, p=0.028) 1.30 (1.03-1.64, p=0.026)
#>                          -                         -
#>  1.17 (0.70-1.95, p=0.556) 1.08 (0.64-1.81, p=0.785)

Created on 2021-09-20 by the reprex package (v2.0.1)

Keep up the great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions