[R] Vector multiplication

jim holtman jholtman at gmail.com
Sun Oct 17 13:21:41 CEST 2010


?outer

> outer(1:2, 1:3, "*")
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    2    4    6
>


On Sun, Oct 17, 2010 at 3:25 AM, Ron Michael <ron_michael70 at yahoo.com> wrote:
> Is there any operator in R, which will multiply each possible combination of the elements of 2 vectors? Suppose I have 2 vectors (1,2) and (1,2,3). If I multiply those 2, I should get:(1,2,3,2,4,6)
> Thanks,
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list