Renders a sdt_describe() object as a flat table of character columns,
one row per level or statistic, ready for knitr::kable(), DT or any
other table renderer. The numbers are formatted with the object's digits;
the object itself keeps them unrounded.
Value
A tibble::tibble() of character columns with a footnotes
attribute.
Details
Missingness follows the object's na_report: a (missing) row, a pair of
missing columns, or a footnote. The legend naming each percent's
denominator is always the first footnote, so a rendered table can never
arrive without one.
Examples
d <- data.frame(grade = c("consultant", "resident", NA), years = c(9, 3, 5))
sdt_describe_render(sdt_describe(d))
#> # A tibble: 7 × 7
#> variable what value n imputed `val%` `all%`
#> * <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 grade consultant 1 (50.0%) "1" "0" "50.0" "33.3"
#> 2 grade resident 1 (50.0%) "1" "0" "50.0" "33.3"
#> 3 grade (missing) 1 (33.3%) "1" "-" "-" "33.3"
#> 4 years mean (SD) 5.67 (3.06) "3" "0" "" ""
#> 5 years median [IQR] 5.00 [4.00, 7.00] "" "" "" ""
#> 6 years range 3.00 to 9.00 "" "" "" ""
#> 7 years (missing) 0 (0.0%) "" "" "" ""