R/plot_utils.R

Defines functions round_to_mult

Documented in round_to_mult

#' @importFrom ggplot2 aes
#' @export
ggplot2::aes

#' @importFrom ggplot2 expansion
#' @export
ggplot2::expansion

#' @title Round an integer to the nearest multiple
#' @description Used to round a year value to the nearest multiple of a defined
#'     value. This is an internal function used to define x-axis breaks for plots.
#'
#' @param num Integer to round
#' @param mult Mulitple value to round to
#' @keywords internal
#'
#' @return A value rounded to the nearest multiple of the \code{mult} parameter
round_to_mult = function(num, mult) {
  round(num / mult) * mult
}
InteragencyEcologicalProgram/smonitr documentation built on Nov. 9, 2020, 7:01 a.m.