[R] All combinations

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Wed Nov 30 13:18:13 CET 2011


expand.grid()

This one is admittedly rather hard to find...

Michael

On Nov 30, 2011, at 7:15 AM, Alaios <alaios at yahoo.com> wrote:

> Dear all,
> I would like something simple to do in R that I do not know how I should search for it.
> 
> Let's say that I have a list of
> a<-c(1,2,3,4,5)
> b<-(6,7,8)
> and I want to get back all their possible cominations like
> 
> 1,6
> 1,7
> 1,8
> 2,6
> 2,7
> 2,8
> 3,6
> 3,7
> 3,8
> and so on.
> 
> How I can do that?
> 
> B.R
> Alex
> 
>    [[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.



More information about the R-help mailing list