#' @importFrom stringr str_replace
#' @export
cut_vector <- function(x, breaks, closed_on_right = TRUE){
breaks <- unique(c(-Inf, breaks, Inf))
x_cut <- cut(x, breaks, right = closed_on_right)
cut_levels <- levels(x_cut) %>% str_replace("(-| )Inf", "")
x_cut %>%
str_replace("(-| )Inf", "") %>%
factor(levels = cut_levels)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.