View source: R/count_bindings.R
set_missing_count | R Documentation |
Controls how missing counts are handled and displayed in the layer
set_missing_count(e, fmt = NULL, sort_value = NULL, denom_ignore = FALSE, ...)
e |
A |
fmt |
An f_str object to change the display of the missing counts |
sort_value |
A numeric value that will be used in the ordering column. This should be numeric. If it is not supplied the ordering column will be the maximum value of what appears in the table plus one. |
denom_ignore |
A boolean. Specifies Whether or not to include the missing counts specified within the ... parameter within denominators. If set to TRUE, the values specified within ... will be ignored. |
... |
Parameters used to note which values to describe as missing. Generally NA and "Missing" would be used here. Parameters can be named character vectors where the names become the row label. |
The modified layer
library(magrittr)
library(dplyr)
mtcars2 <- mtcars %>%
mutate_all(as.character)
mtcars2[mtcars$cyl == 6, "cyl"] <- NA
tplyr_table(mtcars2, gear) %>%
add_layer(
group_count(cyl) %>%
set_missing_count(f_str("xx ", n), Missing = NA)
) %>%
build()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.