tags:

views:

217

answers:

2

i'm outputting a dataframe to html via xtable now (tip to Shane, little nicer than r2html). I want to add commas to numbers in a couple columns of the table. I figured before i did my own paste hack I'd check if there is a built in way to do this. Anyone.

A: 

i don't know of any.. haven't found neither..

it seems you'll have to write your self pal

EDIT: alright, sorry, i've been wrong!

Itay
+8  A: 

You might want to consider transforming the column using formatC

> formatC(1:10 * 100000, format="d", big.mark=',')
 [1] "100,000"   "200,000"   "300,000"   "400,000"   "500,000"   "600,000"  
 [7] "700,000"   "800,000"   "900,000"   "1,000,000"
Jonathan Chang
i knew it was something like that, thanks a lot, huge timesaver
Dan