In the example below, it seems like duplicate N cause an issue with the flextable creation.
library(table1)
#>
#> Attaching package: 'table1'
#> The following objects are masked from 'package:base':
#>
#> units, units<-
foo <- data.frame(A = rep(1:2, each = 3), B = rep(1:3, each = 2), C = 1:6)
mytab <- table1(~C|A+B, data = foo)
#> Warning in table1.formula(~C | A + B, data = foo): Terms to the right of '|' in
#> formula 'x' define table columns and are expected to be factors with meaningful
#> labels.
t1flex(mytab)
#> Error in flextable(data): duplicated col_keys: 2
#> (N=1), 1
#> (N=2), 3
#> (N=2)
In the example below, it seems like duplicate N cause an issue with the flextable creation.
Created on 2023-03-15 with reprex v2.0.2