Re: [R] Data frame divison by another data frame with common groups and different length

2012-09-18 Thread Rui Barradas
Hello, Try the following. agg <- aggregate(buddleiat ~ samplet + datet, data = traffic, FUN = mean) mrg <- merge(encounters, agg, by.x = c("samplec", "datec"), by.y = c("samplet", "datet")) mrg$Div <- with(mrg, Bladen/buddleiat) Hope this helps, Rui Barradas Em 18-09-2012 12:1

Re: [R] Data frame divison by another data frame with common groups and different length

2012-09-18 Thread R. Michael Weylandt
On Tue, Sep 18, 2012 at 12:17 PM, Marta Miguel wrote: > Dear all, > > > I have two different data frames, that have two common variables: date and > sample. Here is a small extract of both of them > >> head(traffic) > datetsessiont samplet buddleiat > 1 07-08-20121 1

[R] Data frame divison by another data frame with common groups and different length

2012-09-18 Thread Marta Miguel
Dear all, I have two different data frames, that have two common variables: date and sample. Here is a small extract of both of them > head(traffic) datetsessiont samplet buddleiat 1 07-08-20121 1 1 2 07-08-20121 1 1 3 07-08-2012