Hi,

   Is there a way to add a colum containing percentages to output from 
aggregate?
for example I have the following from aggregate:
 
(aggregate(data[,cbind("A","B","C","D","E","F")], by=list(data$producttype), 
sum))
                   Group.1     A             B                 C             D  
               E             F
1       ProductA        0.506626        0.413133        0.494486        0.35114 
        0.153208        0.045601
2       Product B       0.176571        0.28645         0.982117        
0.724125        0.727259        0.033789


I want to have columns to show for e.g. column E/F as G% aand C/D as T%?

can I divided E/F or C/D and add them as 2 columns to the results of the 
aggregate function somehow?
 
Which I then pipe ot html:
print(xtable(format(data, big.mark=',', 
sep='')),include.rownames=FALSE,type='html')


thanks
Dhruv

        [[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