Re: [R] Grouping by interval

2007-12-07 Thread Benilton Carvalho
Check the cut() function. b On Dec 7, 2007, at 4:04 AM, "Sonia Mehault" <[EMAIL PROTECTED]> wrote: > Hello, > > I have a dataframe of say 20 lines with one line per individual. I > want to group these 20 individuals > by length class (eg. of 5cm) and get the mean value of all the other > vari

Re: [R] Grouping by interval

2007-12-07 Thread Andrej Blejec
[EMAIL PROTECTED] > Subject: [R] Grouping by interval > > Hello, > > I have a dataframe of say 20 lines with one line per individual. I want to > group these 20 individuals > by length class (eg. of 5cm) and get the mean value of all the other > variables (eg VarA and

Re: [R] Grouping by interval

2007-12-07 Thread Henrique Dallazuanna
Try this: Vec <- cut(Data[,1], breaks=c(10,15,20,25,30), include=T, right=F) Data <- data.frame(Data, Vec) aggregate(Data[,2:3], list(Data$Vec), mean) On 07/12/2007, Sonia Mehault <[EMAIL PROTECTED]> wrote: > Hello, > > I have a dataframe of say 20 lines with one line per individual. I want to

Re: [R] Grouping by interval

2007-12-07 Thread Jarosław Jasiewicz
Sonia Mehault pisze: > Hello, > > I have a dataframe of say 20 lines with one line per individual. I want to > group these 20 individuals > by length class (eg. of 5cm) and get the mean value of all the other > variables (eg VarA and VarB) for each length class > > My dataframe is as follow: > >

[R] Grouping by interval

2007-12-07 Thread Sonia Mehault
Hello, I have a dataframe of say 20 lines with one line per individual. I want to group these 20 individuals by length class (eg. of 5cm) and get the mean value of all the other variables (eg VarA and VarB) for each length class My dataframe is as follow: Length <- 10:30 VarA <- seq(1000,1200,