[R] To summary data

John Kane jrkrideau at inbox.com
Mon May 14 16:08:40 CEST 2012


One way is to use the reshape2 package
===============================
library(reshape2)
dcast(xx,  A ~ . , sum)
================================

John Kane
Kingston ON Canada


> -----Original Message-----
> From: mrzung46 at gmail.com
> Sent: Sun, 13 May 2012 22:14:02 -0700 (PDT)
> To: r-help at r-project.org
> Subject: [R] To summary data
> 
> hi all,
> 
> my data is here,
> --------------------------------------------------------------------------------------------------
> data
> 
>   clss number
> 1    A      1
> 2    B      2
> 3    C      3
> 4    A      4
> 5    B      5
> 6    C      6
> 7    A      7
> 8    B      8
> 9    C      9
> -----------------------------------------------------------------------------------------------------
> I want to this format
> 
> clss number
> A      12
> B      15
> C      18
> 
> is there a way to solve this problem?
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/To-summary-data-tp4629887.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!



More information about the R-help mailing list