as.vector(t(outer(A, B)))
[1]  9 10 11 12 18 20 22 24 27 30 33 36

HTH,
Dennis

On Fri, Jul 23, 2010 at 8:11 AM, aegea <gcheer3@gmail.com> wrote:

>
> 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.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

