accounting format

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

accounting format

Parlamis Franklin
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

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: accounting format

Gabor Grothendieck
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 <[hidden email]> 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
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Loading...