Re: [R] by class...

2013-12-21 Thread John Kane
Nominate for a fortune. John Kane Kingston ON Canada > -Original Message- > From: jdnew...@dcn.davis.ca.us You seem to be falling prey to a common misconception that "R" is some monolithic tool, when in fact it is a herd of cats. ___

Re: [R] by class...

2013-12-20 Thread Jeff Newmiller
You seem to be falling prey to a common misconception that "R" is some monolithic tool, when in fact it is a herd of cats. The "by" function, from the "base" package, returns a list of results returned by your function. One approach to making a data frame out of that is to use the simplify2arra

Re: [R] by class...

2013-12-20 Thread David Winsemius
On Dec 20, 2013, at 9:45 AM, David Winsemius wrote: > > On Dec 20, 2013, at 9:38 AM, Onur Uncu wrote: > >> I used the by() function on a data.frame to get sums of the data grouped by >> 2 factors. The function worked however the output is in a class called 'by'. >> Not familiar with this clas

Re: [R] by class...

2013-12-20 Thread arun
Hi, You can also try: library(reshape2) dcast(as.data.frame(as.table(by(warpbreaks[,1],warpbreaks[,-1],sum))),wool~tension, value.var="Freq") A.K. On , arun wrote: Hi, Try: as.table(by(warpbreaks[,1],warpbreaks[,-1],sum)) #or to convert to data.frame as.data.frame(as.table(by(warpbreaks[,1

Re: [R] by class...

2013-12-20 Thread arun
Hi, Try: as.table(by(warpbreaks[,1],warpbreaks[,-1],sum)) #or to convert to data.frame as.data.frame(as.table(by(warpbreaks[,1],warpbreaks[,-1],mean))) A.K. On Friday, December 20, 2013 12:39 PM, Onur Uncu wrote: I used the by() function on a data.frame to get sums of the data grouped by 2

Re: [R] by class...

2013-12-20 Thread David Winsemius
On Dec 20, 2013, at 9:38 AM, Onur Uncu wrote: > I used the by() function on a data.frame to get sums of the data grouped by 2 > factors. The function worked however the output is in a class called 'by'. > Not familiar with this class. How can I turn the output into a nice table > where columns

[R] by class...

2013-12-20 Thread Onur Uncu
I used the by() function on a data.frame to get sums of the data grouped by 2 factors. The function worked however the output is in a class called 'by'. Not familiar with this class. How can I turn the output into a nice table where columns represent values of factor1, row represent values of fa