answer to your second question:

> paste("$", format(1234567.77, big.mark=','), sep='')
[1] "$1,234,568"
>

you will have to go through each column you want and explicitly do it:

> x
         Region Population   Income Illiteracy Life Exp    Murder  HS
Grad    Frost      Area
1     Northeast   5495.111 4570.222   1.000000 71.26444  4.722222 53.96667
132.7778  18141.00
2         South   4208.125 4011.938   1.737500 69.70625 10.581250 44.34375
64.6250  54605.12
3 North Central   4803.000 4611.083   0.700000 71.76667  5.275000 54.51667
138.8333  62652.00
4          West   2915.308 4702.615   1.023077 71.23462  7.215385 62.00000
102.1538 134463.00
> x$Population <- paste("$", format(x$Population, big.mark=','), sep='')
> x
         Region Population   Income Illiteracy Life Exp    Murder  HS
Grad    Frost      Area
1     Northeast $5,495.111 4570.222   1.000000 71.26444  4.722222 53.96667
132.7778  18141.00
2         South $4,208.125 4011.938   1.737500 69.70625 10.581250 44.34375
64.6250  54605.12
3 North Central $4,803.000 4611.083   0.700000 71.76667  5.275000 54.51667
138.8333  62652.00
4          West $2,915.308 4702.615   1.023077 71.23462  7.215385 62.00000
102.1538 134463.00
>


On Sun, Sep 21, 2008 at 6:03 PM, DS <[EMAIL PROTECTED]> wrote:

> Hi,
>
> 1)   I have noticed that when I use the aggregate function it outputs
> numbers in the results. for example:
> aggregate by product
>
>    group.1       Aggregate
> 1    ProductA   1000400.00
> 2    ProductB   23232323.00
> 3    Missing      232323.00
>
> is there a way to suppress the numbers infront of aggregate outputs.  I
> checked and they don't look like columns when I do a summary so I can't -1
> them away.
>
> 2) is there an easy way to then take my aggregate matrix and then format
> the sum wtih $ and commas. for e.g instead 10000 it should show
> $10,000.00?
>
> I am trying to create a report and am piping the aggregate into an xtable
> and feeding it R2html.
>
> thanks
> Dhruv
>
> ------------------------------------------------------------
> Medical Billing and Coding Training
>
> ools.
>
> http://tagline.excite.com/fc/JkJQPTgMxYL8ba16zHPqHis4q6x4p3rbpaGcEAQIui8YyxCoQBNUxa/
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to