R/utils.R

Defines functions apply_precision

Documented in apply_precision

#' Apply precision (round helper)
#'
#' Simple wrapper around base \code{round()} used by tests and examples.
#'
#' @param x Numeric vector.
#' @param n Integer number of digits to keep. If NULL, return x unchanged.
#' @return Numeric vector rounded to \code{n}.
#' @export
apply_precision <- function(x, n = NULL) {
  if (is.null(n)) x else round(x, digits = n)
}

Try the kfre package in your browser

Any scripts or data that you put into this service are public.

kfre documentation built on Aug. 28, 2025, 9:09 a.m.