Ken Knoblauch wrote:
>
> How about
>
> do.call("expand.grid", rep(list(c("u", "l")), 3))
> Var1 Var2 Var3
> 1uuu
> 2luu
> 3ulu
> 4llu
> 5uul
> 6lul
> 7ull
> 8lll
>
>
... which can now be nicely gen
desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of
> data.
> ~ John Tukey
>
> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Namens Gavin Simpson
> Verzonden: maandag 23 juni 2008 15:51
D]
Namens Gavin Simpson
Verzonden: maandag 23 juni 2008 15:51
Aan: Megh Dal
CC: [EMAIL PROTECTED]
Onderwerp: Re: [R] expand.grid() function
On Mon, 2008-06-23 at 06:16 -0700, Megh Dal wrote:
> Hi,
>
> I have one question on expand.grid() function.
>
> When I write following
Megh Dal yahoo.com> writes:
> I have one question on expand.grid() function.
> When I write following syntax :expand.grid(c("u", "l"),
>c("u", "l"), c("u", "l")) I get following as
> desired :
> Var1 Var2 Var3
> 1uuu
> 2luu
> 3ulu
> 4llu
> 5
On Mon, 2008-06-23 at 06:16 -0700, Megh Dal wrote:
> Hi,
>
> I have one question on expand.grid() function.
>
> When I write following syntax :expand.grid(c("u", "l"), c("u", "l"),
> c("u", "l")) I get following as desired :
> Var1 Var2 Var3
> 1uuu
> 2luu
> 3
Hi Derek,
I love this function as well. If 'mat' is your matrix,
> (mat <- matrix(1:15,ncol=3))
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
[4,]49 14
[5,]5 10 15
how about
> expandedDF <- do.call(`expand.grid`,as.data.frame(mat))
> head(expand
Yes, that works perfectly. Thank you for your help!
Derek
Charilaos Skiadas-3 wrote:
>
> Hi Derek,
> On Dec 23, 2007, at 10:59 PM, dxc13 wrote:
>
>>
>> useR's,
>>
>> I have used expand.grid() several times and like the results it
>> gives me. I
>> am now trying something with it that I h
Hi Derek,
On Dec 23, 2007, at 10:59 PM, dxc13 wrote:
>
> useR's,
>
> I have used expand.grid() several times and like the results it
> gives me. I
> am now trying something with it that I have not been able to get to
> work.
> For any n column matrix I would like to run this function on those
8 matches
Mail list logo