#' adds proportion values to count() function
#'
#' adds proportion values to count() function
#' @param data is the data
#' @param ... the variables for which to count unique levels
#' @digits the number of digits to round to
#' @keywords proportional count
#' @export
#' @examples
#' prop_count(mtcars, cyl)
prop_count <- function(data, ..., digits = 2){
data %>%
dplyr::count(...) %>%
dplyr::mutate(prop = round(n / sum(n), digits))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.