[R] How to get minimum value by group

2010-01-11 Thread JustinNabble
I'd like to get a long data set of minimum values from groups in another data set. The following almost does what I want. (Note, I'm using the word factor differently from it's meaning in R; bad choice of words) myframe = data.frame(factor1 = rep(1:2,each=8), factor2 = rep(c(a,b),each=4,

Re: [R] How to get minimum value by group

2010-01-11 Thread David Winsemius
On Jan 11, 2010, at 7:58 PM, JustinNabble wrote: I'd like to get a long data set of minimum values from groups in another data set. The following almost does what I want. (Note, I'm using the word factor differently from it's meaning in R; bad choice of words) myframe =

Re: [R] How to get minimum value by group

2010-01-11 Thread Peter Alspach
-project.org Subject: [R] How to get minimum value by group I'd like to get a long data set of minimum values from groups in another data set. The following almost does what I want. (Note, I'm using the word factor differently from it's meaning in R; bad choice of words) myframe

Re: [R] How to get minimum value by group

2010-01-11 Thread Gabor Grothendieck
Try this: aggregate(myframe[4], myframe[1:3], min) factor1 factor2 factor3 y 1 1 a x 1 2 2 a x 9 3 1 b x 5 4 2 b x 13 5 1 a y 3 6 2 a y 11 7 1 b y 7 8 2