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
[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
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
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:
>
>
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,
5 matches
Mail list logo