You can always write a script to do what you want.  This will get you the
results you want.

> a1 <- rbind(1:3, 4:6)
> a2 <- rbind(7:8, 9:10)
> result <- NULL  # initialize the output
> for (i in seq(ncol(a2))){
+     for (j in seq(ncol(a1))){
+         result <- cbind(result, c(a1[, j], a2[, i]))
+     }
+ }
> a1
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    4    5    6
> a2
     [,1] [,2]
[1,]    7    8
[2,]    9   10
> result
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    2    3    1    2    3
[2,]    4    5    6    4    5    6
[3,]    7    7    7    8    8    8
[4,]    9    9    9   10   10   10
>


On Sun, Apr 18, 2010 at 3:22 PM, anderson nuel <anderson....@gmail.com>wrote:

> Hello,
>
> thank you for your Help.
>
> I try this function 'combn' and 'expand. grid'. But, This function don't
> give the same results with 'combvec'.
>
>
>
> Best Regards
>
> 2010/4/18 Tal Galili <tal.gal...@gmail.com>
>
> > Maybe:
> >
> > *?expand*.*grid*
> > And:
> > ?combn
> >
> >
> > ?
> >
> > ----------------Contact
> > Details:-------------------------------------------------------
> > Contact me: tal.gal...@gmail.com |  972-52-7275845
> > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> > www.r-statistics.com (English)
> >
> >
> ----------------------------------------------------------------------------------------------
> >
> >
> >
> >
> > On Sun, Apr 18, 2010 at 1:00 PM, anderson nuel <anderson....@gmail.com
> >wrote:
> >
> >> Hello,
> >>
> >>  I would like to create all combinations of vectors. I find on Matalb
> >> this
> >> function 'combvec' which create  all combinations of vectors.
> >>
> >> Please could you help me to find the corresponds function of 'combvec'.
> >>
> >> For example:
> >>
> >> On Matlab
> >>
> >> >> a1 = [1 2 3; 4 5 6]
> >>
> >> a1 =
> >>
> >>     1     2     3
> >>     4     5     6
> >>
> >> >> a2 = [7 8; 9 10]
> >>
> >> a2 =
> >>
> >>     7     8
> >>     9    10
> >>
> >> >> a3 = combvec(a1,a2)
> >>
> >> a3 =
> >>
> >>     1     2     3     1     2     3
> >>     4     5     6     4     5     6
> >>     7     7     7     8     8     8
> >>     9     9     9    10    10    10
> >>
> >> Best Regards
> >>
> >>        [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> 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<http://www.r-project.org/posting-guide.html>
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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<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?

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to