This takes a table1 object and outputs a `flextable` version.

table1_flextable(tab, spanner = NULL)

Arguments

tab

the table1 object

spanner

the label above the grouping variable (if table1 is grouped) or any label you want to include over the statistics column(s)

Examples


library(furniture)
library(dplyr)

data('nhanes_2010')
nhanes_2010 %>%
  group_by(asthma) %>%
  table1(age, marijuana, illicit, rehab, na.rm = FALSE) %>%
  table1_flextable(spanner = "Asthma")
#> Using dplyr::group_by() groups: asthma
#> 

Asthma

Characteristic

Yes, n = 251

No, n = 1164

age

23.0 (3.9)

23.4 (4.0)

marijuana

Yes

131 (52.2%)

584 (50.2%)

No

97 (38.6%)

434 (37.3%)

NA

23 (9.2%)

146 (12.5%)

illicit

Yes

23 (9.2%)

117 (10.1%)

No

205 (81.7%)

901 (77.4%)

NA

23 (9.2%)

146 (12.5%)

rehab

Yes

10 (4%)

37 (3.2%)

No

121 (48.2%)

547 (47%)

NA

120 (47.8%)

580 (49.8%)