Re: [R] aggregate by factor

2010-01-30 Thread Dennis Murphy
Hi: You could complete the entire process in one shot with the plyr package, using function ddply. Using the piece of data supplied, > ddply(motifList, .(events), summarize, freq = length(events), score = median(score)) events freq score 1 aehjm1 0.0833 2 aeijm2 -0.2500

Re: [R] aggregate by factor

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 4:46 PM, david hilton shanabrook wrote: On 30 Jan 2010, at 4:20 PM, David Winsemius wrote: On Jan 30, 2010, at 4:09 PM, david hilton shanabrook wrote: I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequ

Re: [R] aggregate by factor

2010-01-30 Thread david hilton shanabrook
On 30 Jan 2010, at 4:20 PM, David Winsemius wrote: > > On Jan 30, 2010, at 4:09 PM, david hilton shanabrook wrote: > >> I have a data frame with two columns, a factor and a numeric. I want to >> create data frame with the factor, its frequency and the median of the >> numeric column >>> head

Re: [R] aggregate by factor

2010-01-30 Thread David Winsemius
On Jan 30, 2010, at 4:09 PM, david hilton shanabrook wrote: I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequency and the median of the numeric column head(motifList) events score 1 aeijm -0.2500 2 begjm -0.2500

[R] aggregate by factor

2010-01-30 Thread david hilton shanabrook
I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequency and the median of the numeric column > head(motifList) events score 1 aeijm -0.2500 2 begjm -0.2500 3 afgjm -0.2500 4 afhjm -0.2500 5 aeijm -0.25