[R-sig-finance] accounting format
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Mar 1 22:43:14 CET 2006
Try this:
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
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
More information about the R-sig-finance
mailing list