Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-02-07 Thread Suharto Anggono Suharto Anggono via R-devel
ecified 'default' is NaN. On Sat, 4/2/17, Martin Maechler <maech...@stat.math.ethz.ch> wrote: Subject: Re: [Rd] RFC: tapply(*, ..., init.value = NA) Cc: R-devel@r-project.org Date: Saturday, 4 February, 2017, 10:48 PM >>>>>

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-02-04 Thread Martin Maechler
-- > On Wed, 1/2/17, Martin Maechler > <maech...@stat.math.ethz.ch> wrote: > Subject: Re: [Rd] RFC: tapply(*, ..., init.value = NA) > Cc: R-devel@r-project.org Date: Wednesday, 1 February, > 2017, 12:14 AM >>>>> Suharto Anggono S

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-02-01 Thread Suharto Anggono Suharto Anggono via R-devel
. The documentation could then say, for example: "If default = NA (the default), NA of appropriate storage mode (0 for raw) is automatically used." On Wed, 1/2/17, Martin Maechler <maech...@stat.math.ethz.ch> wrote: Subject: Re:

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-31 Thread Martin Maechler
> Suharto Anggono Suharto Anggono via R-devel > on Tue, 31 Jan 2017 15:43:53 + writes: > Function 'aggregate.data.frame' in R has taken a different route. With drop=FALSE, the function is also applied to subset corresponding to combination of grouping

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-31 Thread Suharto Anggono Suharto Anggono via R-devel
Function 'aggregate.data.frame' in R has taken a different route. With drop=FALSE, the function is also applied to subset corresponding to combination of grouping variables that doesn't appear in the data (example 2 in https://stat.ethz.ch/pipermail/r-devel/2017-January/073678.html). Because

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-28 Thread Martin Maechler
> Henrik Bengtsson > on Fri, 27 Jan 2017 09:46:15 -0800 writes: > On Fri, Jan 27, 2017 at 12:34 AM, Martin Maechler > wrote: >> >> > On Jan 26, 2017 07:50, "William Dunlap via R-devel" >>

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Henrik Bengtsson
On Fri, Jan 27, 2017 at 12:34 AM, Martin Maechler wrote: > > > On Jan 26, 2017 07:50, "William Dunlap via R-devel" > > > wrote: > > > It would be cool if the default for tapply's init.value could be > > FUN(X[0]), so it would be

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Martin Maechler
> Suharto Anggono Suharto Anggono via R-devel > on Fri, 27 Jan 2017 16:36:59 + writes: > The "no factor combination" case is distinguishable by 'tapply' with simplify=FALSE. >> D2 <- data.frame(n = gl(3,4), L = gl(6,2, labels=LETTERS[1:6]), N=3)

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Suharto Anggono Suharto Anggono via R-devel
The "no factor combination" case is distinguishable by 'tapply' with simplify=FALSE. > D2 <- data.frame(n = gl(3,4), L = gl(6,2, labels=LETTERS[1:6]), N=3) > D2 <- D2[-c(1,5), ] > DN <- D2; DN[1,"N"] <- NA > with(DN, tapply(N, list(n,L), FUN=sum, simplify=FALSE)) ABCDEF 1

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Gabor Grothendieck
If xtabs is enhanced then as.data.frame.table may also need to be modified so that it continues to be usable as an inverse, at least to the degree feasible. On Thu, Jan 26, 2017 at 5:42 AM, Martin Maechler wrote: > Last week, we've talked here about "xtabs(), factors

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Martin Maechler
> On Jan 26, 2017 07:50, "William Dunlap via R-devel" > wrote: > It would be cool if the default for tapply's init.value could be > FUN(X[0]), so it would be 0 for FUN=sum or FUN=length, TRUE for > FUN=all, -Inf for FUN=max, etc. But that would take

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-26 Thread Henrik Bengtsson
On a related note, the storage mode should try to match ans[[1]] (or unlist:ed and) when allocating 'ansmat' to avoid coercion and hence a full copy. Henrik On Jan 26, 2017 07:50, "William Dunlap via R-devel" wrote: It would be cool if the default for tapply's

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-26 Thread William Dunlap via R-devel
It would be cool if the default for tapply's init.value could be FUN(X[0]), so it would be 0 for FUN=sum or FUN=length, TRUE for FUN=all, -Inf for FUN=max, etc. But that would take time and would break code for which FUN did not work on length-0 objects. Bill Dunlap TIBCO Software wdunlap

[Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-26 Thread Martin Maechler
Last week, we've talked here about "xtabs(), factors and NAs", -> https://stat.ethz.ch/pipermail/r-devel/2017-January/073621.html In the mean time, I've spent several hours on the issue and also committed changes to R-devel "in two iterations". In the case there is a *Left* hand side part to