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

Rolf Turner rolf.turner at xtra.co.nz
Mon Jun 10 11:20:14 CEST 2013


Your question makes no sense at all.  The grid expansion
has 9 rows.  In case you hadn't noticed, 9 is an odd number
(i.e. not divisible by 2).  There are no "halves".

Do not expect the list to read your mind.  Instead, ask a
meaningful question.

     cheers,

         Rolf Turner

On 10/06/13 17:25, Gundala Viswanath 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?



More information about the R-help mailing list