[R] How to expand.grid with string elements (the half!)

MacQueen, Don macqueen1 at llnl.gov
Mon Jun 10 17:16:44 CEST 2013


If you can explain why those particular six combinations out of the
complete set of nine, then perhaps someone can tell you how.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 6/9/13 10:25 PM, "Gundala Viswanath" <gundalav at gmail.com> wrote:

>I have the following result of expand grid:
>
>> d <- expand.grid(c("x","y","z"),c("x","y","z"))
>
>What I want is to create a combination of strings
>but only the half of the all combinations:
>
>  Var1 Var2
>1    x    x
>2    y    x
>3   y    y
>4   z    y
>5   x    z
>6    z    z
>
>
>What's the way to do it?
>
>G.V.
>
>	[[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