[R-sig-finance] accounting format
ggrothendieck at gmail.com
Wed Mar 1 22:43:14 CET 2006
zz <- matrix(-10:13,6) * 100.11 # test data
format(ifelse(zz < 0, sprintf("(%.2f)", -zz), sprintf("%.2f ", zz)),
justify = "right")
On 3/1/06, Parlamis Franklin <fparlamis at mac.com> wrote:
> does anyone know a quick and dirty way to format numerics so that
> negative values appear as they do in accounting statements
> (surrounded by parentheses), rather than preceded by a negative sign?
> i've been toying with format() and formatC(), but can't figure out
> how to do this. thanks in advance.
> franklin parlamis
> R-sig-finance at stat.math.ethz.ch mailing list
More information about the R-sig-finance