Try this: with(merge(dtf, dtf2), data.frame(y, m, inc = inc/def))
On 7/11/06, Dimitri Szerman <[EMAIL PROTECTED]> wrote: > Hi, > > I have two data frames. One is like > > > dtf = data.frame(y=c(rep(2002,4), rep(2003,5)), > + m=c(9:12, 1:5), > + def=c(.74,.75,.76,.78,.80,.82,.85,.85,.87)) > > and the other > > dtf2 = data.frame(y=rep( c(2002,2003),20), > m=c(trunc(runif(20,1,5)),trunc(runif(20,9,12))), > inc=rnorm(40,mean=300,sd=150) ) > > What I want is to divide dtf2$inc by dtf1$def by the "levels" of y and m > (inc is income and def is the deflator). Any help in vectorizing this is > welcome. > > Thank you, > Dimitri ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
