R/round_nearest.R

Defines functions round_nearest

Documented in round_nearest

#' @title Round to the nearest number.
#'
#'
#' @param x numeric: a numeric vector.
#' @param base integer: nearest integer to round round the number.
#' @author Santiago Caño-Muñiz
#'
#' @export


round_nearest <- function(x, base = 5){

  n <- base*round(x/base)
  return(n)
  }
phisanti/MyFunctions documentation built on Sept. 22, 2021, 7:37 p.m.