Skip to content

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

3 messages · Marta Miguel, R. Michael Weylandt, Rui Barradas

#
On Tue, Sep 18, 2012 at 12:17 PM, Marta Miguel <martamiguel12 at gmail.com> wrote:
I believe changing tapply() --> ave() will be a good start.

Cheers,
Michael
#
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:17, Marta Miguel escreveu: