Re: [Rd] unsplit list of data.frames with one column

2009-05-09 Thread Peter Dalgaard
Will Gray wrote: Perhaps this is the intended behavior, but I discovered that unsplit throws an error when it tries to set rownames of a variable that has no dimension. This occurs when unsplit is passed a list of data.frames that have only a single column. An example: df <- data.frame(le

[Rd] Improve aggregate.default ...?

2009-05-09 Thread Gavin Simpson
Hi, I find it a bit annoying that aggregate.default forces the returned object to loose the 'name' of the variable aggregated, replacing it with 'x'. A brief example: > dat <- data.frame(A = runif(100), B = rnorm(100), + Group = gl(4, 25)) > with(dat, aggregate(A, by = list(Gr

Re: [Rd] Improve aggregate.default ...?

2009-05-09 Thread Gabor Grothendieck
Try this: > aggregate(dat["A"], dat["Group"], mean) Group A 1 1 0.4944810 2 2 0.4765412 3 3 0.4521068 4 4 0.4989000 On Sat, May 9, 2009 at 8:14 AM, Gavin Simpson wrote: > Hi, > > I find it a bit annoying that aggregate.default forces the returned > object to loose the '

Re: [Rd] Improve aggregate.default ...?

2009-05-09 Thread Gavin Simpson
On Sat, 2009-05-09 at 08:23 -0400, Gabor Grothendieck wrote: > Try this: > > > aggregate(dat["A"], dat["Group"], mean) > Group A > 1 1 0.4944810 > 2 2 0.4765412 > 3 3 0.4521068 > 4 4 0.4989000 Thanks Gabor. Ideally, aggregate.default should "work" whatever indexing one u

Re: [Rd] suggestion for extending ?as.factor

2009-05-09 Thread Michael Dewey
At 14:18 08/05/2009, Martin Maechler wrote: > "PS" == Petr Savicky > on Fri, 8 May 2009 11:01:55 +0200 writes: Somewhere below Martin asks for alternatives from list readers. I do not have alternatives, but I do have two comments, one immediately below this, the other embedded i

Re: [Rd] anyDuplicated(incomp=NA) fails

2009-05-09 Thread Martin Maechler
> William Dunlap > on Fri, 8 May 2009 16:16:56 -0700 writes: > With today's R 2.10.0(devel) I get: >> anyDuplicated(c(1,NA,3,NA,5), incomp=NA) # expect 0 > Warning: stack imbalance in 'anyDuplicated', 20 then 21 > Warning: stack imbalance in '.Internal', 19 then 20

Re: [Rd] unsplit list of data.frames with one column

2009-05-09 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: > Will Gray wrote: >> >> Perhaps this is the intended behavior, but I discovered that unsplit >> throws an error when it tries to set rownames of a variable that has >> no dimension. This occurs when unsplit is passed a list of >> data.frames that have only a single column. >

Re: [Rd] suggestion for extending ?as.factor

2009-05-09 Thread Martin Maechler
> "PS" == Petr Savicky > on Fri, 8 May 2009 18:10:56 +0200 writes: PS> On Fri, May 08, 2009 at 05:14:48PM +0200, Petr Savicky wrote: >> Let me suggest to consider the following modification, where match() is done >> on the strings, not on the original values. >> level