R/format_bins.R

Defines functions format_bins

Documented in format_bins

#' format bin labels
#' 
#' @param bins a vector of bin labels to be formated
#' 
#' @return a vector of formated bin labels
format_bins <- function(bins) {
  plus_bins <- which(grepl(">",bins))
  bins[-plus_bins] <- as.integer(bins[-plus_bins])
  bins[plus_bins] <- paste0(">",
                            as.integer(
                            unlist(strsplit(bins[plus_bins],">")[[1]][2])
                            )
                            )
  return(bins)
}
jmlondon/wcUtils documentation built on March 19, 2024, 8:40 a.m.