R/p_price.R

Defines functions p_price

Documented in p_price

#' A function to write pretty prices in `bookdown` reports
#' @param x A number to be printed
#' @param currency The name of the currency
#' @param digi Number of digits
#' @param ... Extra arguments for `formatC()`
#' @export p_price
#'

p_price <- function(x, digi = 2, currency = "EUR", ...){

        paste(formatC(round(x, digits = digi),
                  big.mark = ",",
                  format = "f",
                  digits = digi, ...), currency)

}
fthielen/tatooheen documentation built on Nov. 8, 2023, 4:37 a.m.