[R] help in vectorization

From: Dimitri Szerman <dimitrijoe_at_ipea.gov.br>
Date: Wed 12 Jul 2006 - 13:58:40 EST


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),

                  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,

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 12 14:02:56 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 16:17:34 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.