[Rd] Potential improvements of ave?

2021-10-24 Thread SOEIRO Thomas
t; > > > > > > > Hi Abby, > > > > > > > > Thank you for your positive feedback. > > > > > > > > I agree for your general comment about sorting. > > > > > > > > For ave specifically, ordering may not help because the out

[Rd] Potential improvements of ave? (Act 2)

2021-04-17 Thread SOEIRO Thomas
Dear list,   This is a follow-up with another potential improvements of ave.   In the doc, x is documented as to be "a numeric", but this is not mandatory.   DF <- data.frame(x = letters, group = rep(1:2, each = 13)) ave(DF$x, DF$group, FUN = function(i) "a") #  [1] "a" "a" "a" "a" "a" "a" "a"

Re: [Rd] Potential improvements of ave?

2021-03-16 Thread Bill Dunlap
t it? (i.e is it relevant for a > patch?) > > Thanks, > > Thomas > > > > > > De : Abby Spurdle > > Envoyé : lundi 15 mars 2021 10:22 > > À : SOEIRO Thomas > > Cc : r-devel@r-project.org > > Objet :

Re: [Rd] Potential improvements of ave?

2021-03-16 Thread Gabriel Becker
t the entiere > data.frame). > >> > >> Thanks, > >> > >> Thomas > >> > >> De : Abby Spurdle > >> Envoyé : lundi 15 mars 2021 10:22 > >> À : SOEIRO Thomas > >>

Re: [Rd] Potential improvements of ave?

2021-03-16 Thread SOEIRO Thomas
hink about it? (i.e is it relevant for a patch?) Thanks, Thomas > > De : Abby Spurdle > Envoyé : lundi 15 mars 2021 10:22 > À : SOEIRO Thomas > Cc : r-devel@r-project.org > Objet : Re: [Rd] Potential improvements of ave? > > H

Re: [Rd] Potential improvements of ave?

2021-03-16 Thread Abby Spurdle
the entiere >> data.frame). >> >> Thanks, >> >> Thomas >> ________ >> De : Abby Spurdle >> Envoyé : lundi 15 mars 2021 10:22 >> À : SOEIRO Thomas >> Cc : r-devel@r-project.org >> Objet : Re: [Rd]

Re: [Rd] Potential improvements of ave?

2021-03-16 Thread Dirk Eddelbuettel
On 16 March 2021 at 10:50, Martin Maechler wrote: | I vaguely remember (from Luke's docs/presentation on ALTREP) | that there are some "missing parts" here. | One of them the not-existing R level functionality, another may be | the C code below R's is.unsorted() ... maybe is.unsorted() |

Re: [Rd] Potential improvements of ave?

2021-03-16 Thread Martin Maechler
t;> >> Thomas >> ________ >> De : Abby Spurdle >> Envoyé : lundi 15 mars 2021 10:22 >> À : SOEIRO Thomas >> Cc : r-devel@r-project.org >> Objet : Re: [Rd] Potential improvements of ave? >>

Re: [Rd] Potential improvements of ave?

2021-03-15 Thread Gabriel Becker
> maintain the order of the input (as ave returns only x and not the entiere > data.frame). > > Thanks, > > Thomas > > De : Abby Spurdle > Envoyé : lundi 15 mars 2021 10:22 > À : SOEIRO Thomas > Cc : r-devel@r-project.org >

Re: [Rd] Potential improvements of ave?

2021-03-15 Thread SOEIRO Thomas
De : Abby Spurdle Envoyé : lundi 15 mars 2021 10:22 À : SOEIRO Thomas Cc : r-devel@r-project.org Objet : Re: [Rd] Potential improvements of ave? EMAIL EXTERNE - TRAITER AVEC PRÉCAUTION LIENS ET FICHIERS Hi Thomas, These are some great suggestions. But I can't help but feel there's

Re: [Rd] Potential improvements of ave?

2021-03-15 Thread Abby Spurdle
Hi Thomas, These are some great suggestions. But I can't help but feel there's a much bigger problem here. Intuitively, the ave function could (or should) sort the data. Then the indexing step becomes almost trivial, in terms of both time and space complexity. And the ave function is not the

Re: [Rd] Potential improvements of ave?

2021-03-13 Thread SOEIRO Thomas
The bottleneck of ave is the call to interaction (i.e. not the call to split/lapply). Therefore, the following code runs as expected (but I may miss something...): ave2 <- function (x, ..., FUN = mean) { if(missing(...)) x[] <- FUN(x) else { #g <- interaction(...)

[Rd] Potential improvements of ave?

2021-03-12 Thread SOEIRO Thomas
Dear all, I have two questions/suggestions about ave, but I am not sure if it's relevant for bug reports. 1) I have performance issues with ave in a case where I didn't expect it. The following code runs as expected: set.seed(1) df1 <- data.frame(id1 = sample(1:1e2, 5e2, TRUE),