R/formatPercent.R

Defines functions formatPercent

Documented in formatPercent

#' Returns a percentage value of a decimal
#'
#' @param x the string
#' @param digits number of decimal places
#' @param ... arguments passed to format.
#' @export
#'
formatPercent <- function(x, digits = 0, ...) {
  paste0(formatC(100 * x, format = "f", digits = digits, ...), "%")
}
mikey-harper/HarpR documentation built on Nov. 9, 2019, 8:04 p.m.