Align "count (parenthetical)" cells, including bare counts
Source:R/cell_format.R
fmt_count_paren_bare.RdDeprecated in 0.8.x (it says so once a session and still works),
removed in 0.9.0: it is fmt_count_paren(x, bare = TRUE), the same
output.
Arguments
- x
Character vector (one table column).
- nbsp
Padding character; defaults to the non-breaking space (U+00A0) so RTF / Word keep the alignment. Pass
" "for plain text.- na
Text to print for a missing value (
NA, andNaN– R counts it as missing). The default""leaves the cell empty, as before. A non-empty token is right-justified with the other cells, so its right edge lines up with theirs.Inf/-Infare not missing and print as"Inf"/"-Inf". See thenaargument ofas_rtftables().
Details
Like fmt_count_paren(), but a bare integer count with no parentheses
(a lone "0" for a zero count, or a raw event total) is also padded into
the same count field, so it lines up under the parenthetical cells instead
of drifting out of line. Cells that do not start with an integer (text,
decimals, empty cells) are still returned unchanged.
Examples
# deprecated: the same as fmt_count_paren(bare = TRUE)
fmt_count_paren(c("1 (1.2%)", "0", "11 (3.6%)", "108 (35.3%)"), bare = TRUE)
#> [1] " 1 ( 1.2%)" " 0 " " 11 ( 3.6%)" "108 (35.3%)"