Re: [R] To summary data
One way is to use the reshape2 package === library(reshape2) dcast(xx, A ~ . , sum) John Kane Kingston ON Canada > -Original Message- > From: mrzun...@gmail.com > Sent: Sun, 13 May 2012 22:14:02 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] To summary data > > hi all, > > my data is here, > -- > data > > clss number > 1A 1 > 2B 2 > 3C 3 > 4A 4 > 5B 5 > 6C 6 > 7A 7 > 8B 8 > 9C 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@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! __ 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.
Re: [R] To summary data
On 14-05-2012, at 07:14, mrzung wrote: > hi all, > > my data is here, > -- > data > > clss number > 1A 1 > 2B 2 > 3C 3 > 4A 4 > 5B 5 > 6C 6 > 7A 7 > 8B 8 > 9C 9 > - > I want to this format > > clss number > A 12 > B 15 > C 18 > > is there a way to solve this problem? ?aggregate mydata <- data.frame(clss=rep(c("A","B","C"),rep=3),number=1:9, stringsAsFactors=FALSE) aggregate(number ~ .,data=mydata,sum) Berend __ 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.
[R] To summary data
hi all, my data is here, -- data clss number 1A 1 2B 2 3C 3 4A 4 5B 5 6C 6 7A 7 8B 8 9C 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@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.