Render Strict Cell Suppression (Categorical)
render_strict_cell_suppression.categorical.Rd
Strictly suppress any counts that are less than 6 with message. This differs
from the more conservative logic of render_cell_suppression.categorical()
.
Arguments
- x
(
character
orfactor
)
A categorical variable to summarize.- ...
Optionally accept a nameddigits
(integer
) orsingle_level_binary
(logical
) argument which specifies the number of digits to round percentages to. Also accepts additional inputs that are passed toprettyNum()
to apply additional formatting to shown results (e.g.,big.mark = ","
).
Examples
x <- factor(c(rep("a", times = nrow(mtcars)), "b"), levels = c("a", "b"))
render_strict_cell_suppression.categorical(x)
#> a
#> "" "32 (97.0%)"
#> b
#> "< 6 obs. (suppressed)"
x2 <- factor(c(rep("a", times = nrow(mtcars))), levels = c("a", "b"))
render_strict_cell_suppression.categorical(x2)
#> a b
#> "" "32 (100.0%)" "0 (0.0%)"
y <- factor(
c(rep("a", times = nrow(mtcars)), "b", "c", "d", "e", "f", "g"),
levels = c("a", "b", "c", "d", "e", "f", "g")
)
render_strict_cell_suppression.categorical(y)
#> a
#> "" "32 (84.2%)"
#> b c
#> "< 6 obs. (suppressed)" "< 6 obs. (suppressed)"
#> d e
#> "< 6 obs. (suppressed)" "< 6 obs. (suppressed)"
#> f g
#> "< 6 obs. (suppressed)" "< 6 obs. (suppressed)"
z <- factor(
c(
rep("a", times = 100),
rep("b", times = 50),
rep("c", times = 7),
rep("d", times = 2)
),
levels = c("a", "b", "c", "d", "e")
)
render_strict_cell_suppression.categorical(z)
#> a
#> "" "100 (62.9%)"
#> b c
#> "50 (31.4%)" "7 (4.4%)"
#> d e
#> "< 6 obs. (suppressed)" "0 (0.0%)"