x <- c(123023,143494035);> format(x, big.mark=",");
[1] " 123,023" "143,494,035"> format(x, big.mark=",", trim=TRUE);
[1] "123,023" "143,494,035"
See also ?prettyNum (and formatC).
/Henrik
On Mon, Sep 22, 2008 at 9:23 PM, Matthew Pettis
<matthew.pettis at gmail.com> wrote:> Hi,
>
> Search through the R archives, and couldn't find my answer... how do
> you format numbers with commas (standard American, one every three
> digits)?
>
> Thanks,
> Matt
>
> --
> It is from the wellspring of our despair and the places that we are
> broken that we come to repair the world.
> -- Murray Waas
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>