Re: [R] Normalizing grouped data in a data frame

2007-11-09 Thread Peter Dalgaard
Greg Snow wrote: > Here is another approach using transform and ave which I think is a > little simpler than the others suggested: > > >> new.data <- transform( iris, >> > + normSW = Sepal.Width / ave(Sepal.Width, Species, FUN=max), > + normSL = Sepal.Length / ave(Sepal.Length, Species

Re: [R] Normalizing grouped data in a data frame

2007-11-09 Thread Greg Snow
r 09, 2007 3:57 AM > To: r-help@r-project.org > Subject: [R] Normalizing grouped data in a data frame > > Hi > I am a newbie to R but have tried a number of ways in R to do > this and can't find a good solution. (I could do it out of R > in perl or awk but would like

Re: [R] Normalizing grouped data in a data frame

2007-11-09 Thread Duncan Murdoch
On 11/9/2007 10:22 AM, Sandy Small wrote: > Thank you very much. > That works nicely. > The trick I particularly needed was "within"which I didn't know about. within() is new in 2.6.0; it's a nice addition. There's also transform() which could be used in this situation, replacing within(subset,

Re: [R] Normalizing grouped data in a data frame

2007-11-09 Thread Sandy Small
Thank you very much. That works nicely. The trick I particularly needed was "within"which I didn't know about. Also nice to get a data frame out with "sparseby" instead of just a mulit-array with "by" Sandy Duncan Murdoch wrote: > Sandy Small wrote: >> Hi >> I am a newbie to R but have tried a nu

Re: [R] Normalizing grouped data in a data frame

2007-11-09 Thread Gabor Grothendieck
On Nov 9, 2007 5:56 AM, Sandy Small <[EMAIL PROTECTED]> wrote: > Hi > I am a newbie to R but have tried a number of ways in R to do this and > can't find a good solution. (I could do it out of R in perl or awk but > would like to know how to do this in R). > > I have a large data frame 49 variables

Re: [R] Normalizing grouped data in a data frame

2007-11-09 Thread Duncan Murdoch
Sandy Small wrote: > Hi > I am a newbie to R but have tried a number of ways in R to do this and > can't find a good solution. (I could do it out of R in perl or awk but > would like to know how to do this in R). > > I have a large data frame 49 variables and 7000 observations however for > simp

[R] Normalizing grouped data in a data frame

2007-11-09 Thread Sandy Small
Hi I am a newbie to R but have tried a number of ways in R to do this and can't find a good solution. (I could do it out of R in perl or awk but would like to know how to do this in R). I have a large data frame 49 variables and 7000 observations however for simplicity I can express it in the f