R/histbreaks.R

#' Create breaks for histogram of integers
#'
#' @code{histbreaks(x)}
#'
#' @param x vector of integers
#'
#' @details when wishing to plot a histogram of integers with breaks of
#' unit increments, use this to generate the breaks.
#'
#' @examples
#' X = round(runif(100,1,20))
#' HB = histbreaks(X)
#' hist(X, breaks = HB)

histbreaks = function(x){
  floor(min(x)):(ceiling(max(x))+1)-0.5
}
helophilus/ColsTools documentation built on May 30, 2019, 4:03 p.m.