[R] unique combinations
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Wed Dec 21 12:40:51 CET 2011
You could read the help for expand.grid very carefully for the answer to this question.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Antje Niederlein <niederlein-rstat at yahoo.de> wrote:
>Hi there,
>
>I have a vector and would like to create a data frame, which contains
>all unique combination of two elements, regardless of order.
>
>myVec <- c(1,2,3)
>
>what expand.grid does:
>
>1,1
>1,2
>1,3
>2,1
>2,2
>2,3
>3,1
>3,2
>3,3
>
>what I would like to have
>
>1,1
>1,2
>1,3
>2,2
>2,3
>3,3
>
>Can anybody help?
>
>______________________________________________
>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