View source: R/count_bindings.R
keep_levels | R Documentation |
In certain cases you only want a layer to include certain values of a factor. The 'keep_levels()' function allows you to pass character values to be included in the layer. The others are ignored. **NOTE: Denominator calculation is unaffected by this function, see the examples on how to include this logic in your percentages'**
keep_levels(e, ...)
e |
A |
... |
Character values to count int he layer |
The modified Tplyr layer object
library(dplyr)
mtcars <- mtcars %>%
mutate_all(as.character)
t <- tplyr_table(mtcars, gear) %>%
add_layer(
group_count(cyl) %>%
keep_levels("4", "8") %>%
set_denom_where(cyl %in% c("4", "8"))
) %>%
build()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.