Can be add dependent label to final results dataframe.

dependent_label(df.out, .data, dependent, prefix = "Dependent: ",
  suffix = "")

Arguments

df.out

Dataframe (results table) to be altered.

.data

Original dataframe.

dependent

Character vector of length 1: quoted name of depdendent variable. Can be continuous, a binary factor, or a survival object of form Surv(time, status)

prefix

Prefix for dependent label

suffix

Suffix for dependent label

Value

Returns the label for the dependent variable, if specified.

Examples

library(dplyr) explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") explanatory_multi = c("age.factor", "obstruct.factor") random_effect = "hospital" dependent = 'mort_5yr' # Separate tables colon_s %>% summary_factorlist(dependent, explanatory, fit_id=TRUE) -> example.summary colon_s %>% glmuni(dependent, explanatory) %>% fit2df(estimate_suffix=" (univariable)") -> example.univariable
#> Waiting for profiling to be done...
#> Waiting for profiling to be done...
#> Waiting for profiling to be done...
#> Waiting for profiling to be done...
colon_s %>% glmmulti(dependent, explanatory) %>% fit2df(estimate_suffix=" (multivariable)") -> example.multivariable
#> Waiting for profiling to be done...
colon_s %>% glmmixed(dependent, explanatory, random_effect) %>% fit2df(estimate_suffix=" (multilevel") -> example.multilevel # Pipe together example.summary %>% finalfit_merge(example.univariable) %>% finalfit_merge(example.multivariable) %>% finalfit_merge(example.multilevel) %>% select(-c(fit_id, index)) %>% dependent_label(colon_s, dependent) -> example.final example.final
#> Dependent: Mortality 5 year Alive Died #> 2 Age <40 years 31 (46.3) 36 (53.7) #> 1 40-59 years 208 (61.4) 131 (38.6) #> 3 60+ years 272 (53.4) 237 (46.6) #> 8 Sex Female 243 (55.6) 194 (44.4) #> 9 Male 268 (56.1) 210 (43.9) #> 4 Obstruction No 408 (56.7) 312 (43.3) #> 5 Yes 89 (51.1) 85 (48.9) #> 6 Perforation No 497 (56.0) 391 (44.0) #> 7 Yes 14 (51.9) 13 (48.1) #> OR (univariable) OR (multivariable) OR (multilevel #> 2 - - - #> 1 0.54 (0.32-0.92, p=0.023) 0.57 (0.34-0.98, p=0.041) 0.75 (0.39-1.44, p=0.382) #> 3 0.75 (0.45-1.25, p=0.270) 0.81 (0.48-1.36, p=0.426) 1.03 (0.55-1.96, p=0.916) #> 8 - - - #> 9 0.98 (0.76-1.27, p=0.889) 0.98 (0.75-1.28, p=0.902) 0.80 (0.58-1.11, p=0.180) #> 4 - - - #> 5 1.25 (0.90-1.74, p=0.189) 1.25 (0.90-1.76, p=0.186) 1.23 (0.82-1.83, p=0.320) #> 6 - - - #> 7 1.18 (0.54-2.55, p=0.672) 1.12 (0.51-2.44, p=0.770) 1.03 (0.43-2.51, p=0.940)