R/Pretty_Functions.R

Defines functions pretty.perc pretty.curr pretty.num

pretty.num <- function(x, p = 1) {
  x <- ifelse(is.na(x), NA, prettyNum(round(x, p), big.mark = ","))
  x
}

pretty.curr <- function(x, p = 0, curr = "£") {
  x <- ifelse(is.na(x), NA, paste(curr, prettyNum(round(x, p), big.mark = ","), sep = " "))
  x
}

pretty.perc <- function(x, p = 2) {
  x <- ifelse(is.na(x), NA, paste(round(x*100, p), '%', sep = " "))
  x
}
Ehsan-F/R-Mixtape documentation built on June 24, 2020, 12:22 a.m.