Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Antoine Fabri
It's not about asking others to do it really, that was a harsh assumption. I'd be happy to propose a version if it helps, I'd be also very happy if it were just a copy of if_else or fifelse (both MIT FWIW). It's a low level building block and it's broken, IMO it's way better to have it available an

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread avi.e.gross
A package with only one function, what a concept! But then it becomes tempting to also create a function like if_else_else() and if_else_default() and of course if_not_else() Joking aside, plenty of functionality in extendible languages like R were written long enough ago that they might b

[Rd] Time to revisit ifelse ?

2025-07-08 Thread Antoine Fabri
Dear r-devel, `ifelse()` has a lot of issues, and for these reasons it has been redone in `dplyr::if_else()` and `data.table::fifelse()`, which are both great. Yet it's an important base R function, it's really hard to program in base R without it and scores probably as high as it gets in the most

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Duncan Murdoch
Rather than asking others to do this, why don't you create a tiny package containing nothing other than an ifelse() replacement? I wouldn't want to depend on dplyr or data.table just to get their versions, but depending on your tiny package wouldn't be an issue. Duncan Murdoch On 2025-07-08

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Avraham Adler
On Tue, Jul 8, 2025 at 10:55 AM Josiah Parry wrote: > > I think the point is not that there needs to be a smaller package for yet > another if-else (https://xkcd.com/927/). It is that if the R-language, as a > whole, had a performant if-else in the base of the language would benefit > **everyone**

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Lluís Revilla
On Tue, 8 Jul 2025 at 17:23, Avraham Adler wrote: > > On Tue, Jul 8, 2025 at 10:55 AM Josiah Parry wrote: > > > > I think the point is not that there needs to be a smaller package for yet > > another if-else (https://xkcd.com/927/). It is that if the R-language, as a > > whole, had a performant i

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Ben Bolker
I think Duncan's point is that R-core are (reasonably) very, very, very conservative about adding things to base R. It would be useful to the community, and would indeed further the discussion, to make a tiny package containing just that function. (Even just copying it from some other package

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Josiah Parry
Avi, appreciate the puns! I don't think anyone is suggesting R-core dedicate all of their time to this problem. To me, the thread is about consensus making (as there is no formal way to do that). Quoting OP here: "It's not about asking others to do it really, that was a harsh assumption. I'd be

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Josiah Parry
I think the point is not that there needs to be a smaller package for yet another if-else (https://xkcd.com/927/). It is that if the R-language, as a whole, had a performant if-else in the base of the language would benefit **everyone** such that a data.table or dplyr or gtools etc. alternative wou

Re: [Rd] Time to revisit ifelse ?

2025-07-08 Thread Duncan Murdoch
Since you and Antoine are volunteering to do the work, why not start in the way I suggested? Write up a comparison of the known ifelse implementations, and either pick the best one, or choose the best parts of each. Put the result in a package containing nothing else, and invite comment from