[R] how to calculate the product of every two elements in two vectors

aegea gcheer3 at gmail.com
Fri Jul 23 17:11:43 CEST 2010


Thanks in advance!

A=c(1, 2,3)
B=c (9, 10, 11, 12)

I want to get C=c(1*9, 1*10, 1*11, 1*12, ....., 3*9, 3*10, 3*11, 3*12)?
C is still a vector with 12 elements
Is there a way to do that?
-- 
View this message in context: http://r.789695.n4.nabble.com/how-to-calculate-the-product-of-every-two-elements-in-two-vectors-tp2300299p2300299.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list