#' (IN DEVELOPMENT) Categorize Age into Bins
#'
#' @description This function categorizes the age of a student using
#' the California Community College System binning definitions.
#'
#' \strong{Age Bin:}
#' \enumerate{
#' \item 19 or Less
#' \item 20 - 24
#' \item 25 - 39
#' \item 40 or Greater
#' \item Unknown
#' }
#'
#' Reference for definition: \url{https://datamart.cccco.edu/App_Doc/Scorecard_Data_Mart_Specs.pdf}
#'
#' @param x An integer vector describing the age of a student
#'
#' @return Returns a character vector of length age with the appropriate bin.
#'
#' @examples
#' x <- c(19, 18, 20, 25, 40, NA)
#'
#' age_bin(x)
#'
#' @export
age_bin <- function(x){
dplyr::case_when(x <= 19 ~ "19 or Less",
between(x, 20, 24) ~ "20-24",
between(x, 25, 39) ~ "25-39",
x >= 40 ~ "40 or Greater",
TRUE ~ "Unknown")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.