format_acct: Function to simply format currency values

Description Usage Arguments Value Examples

View source: R/format_acct.R

Description

Formatting will follow excel accounting style

Usage

1
format_acct(x, digits = 2, shown.in = NULL)

Arguments

x

numeric vector

digits

numeric to denote number of decimal places

shown.in

character to express value in thousands, millions or billions. Accepts c('k', 'm', 'b').

Value

character vector of length(x) with desired formatting

Examples

1
2
3
4
5
6
7
8
9
## Not run: 

format_acct(100, digits = 0)

library(dplyr)
mtcars %>% mutate(msrp = runif(nrow(.), 20000, 30000), msrp_format = format_acct(msrp, shown.in = 'k'))


## End(Not run)

willbradley/acctR documentation built on May 3, 2019, 9:39 p.m.