Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-29 Thread Suharto Anggono Suharto Anggono via R-devel
Interspersed below. Subject: Re: ifelse() woes ... can we agree on a ifelse2() ? To: r-de...@lists.r-project.org Date: Sunday, 27 November, 2016, 12:14 AM On current 'ifelse' code in R: ... * If 'test' is a factor, doing storage.mode(test) <- "log

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-28 Thread Gabriel Becker
Well, that's embarrassing. Sorry for the noise on that front, everyone. I misunderstood something from the aforementioned unrelated conversation I was having, but not double checking is on me (I rarely use if else and when I do I avoid that situation in my own code, which is why I didn't already kn

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-28 Thread Martin Maechler
> Suharto Anggono Suharto Anggono via R-devel > on Sat, 26 Nov 2016 17:14:01 + writes: > Just stating, in 'ifelse', 'test' is not recycled. As I said in "R-intro: length of 'ifelse' result" (https://stat.ethz.ch/pipermail/r-devel/2016-September/073136.html), ifelse(conditio

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-28 Thread Martin Maechler
> Related to the length of 'ifelse' result, I want to say that "example of > different return modes" in ?ifelse led me to perceive a wrong thing in the > past. > ## example of different return modes: > yes <- 1:3 > no <- pi^(0:3) > typeof(ifelse(NA,yes, no)) # logical >

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-26 Thread Suharto Anggono Suharto Anggono via R-devel
Related to the length of 'ifelse' result, I want to say that "example of different return modes" in ?ifelse led me to perceive a wrong thing in the past. ## example of different return modes: yes <- 1:3 no <- pi^(0:3) typeof(ifelse(NA,yes, no)) # logical typeof(ifelse

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-26 Thread Suharto Anggono Suharto Anggono via R-devel
For S Ellison, just clarifying, I am Suharto Anggono, not Martin Maechler. "Martin et al.," from my previous E-mail was the beginning of message from Gabriel Becker, that I quoted. The quoted "still a bit disappointed that nobody has taken a look" is from Martin Maechler. In all of the proposed

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-26 Thread S Ellison
> Just stating, in 'ifelse', 'test' is not recycled. As I said in "R-intro: > length of 'ifelse' result" > (https://stat.ethz.ch/pipermail/r-devel/2016-September/073136.html), > ifelse(condition, a, b) > returns a vector of the length of 'condition', even if 'a' or 'b' is longer. That is indee

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-26 Thread Suharto Anggono Suharto Anggono via R-devel
Just stating, in 'ifelse', 'test' is not recycled. As I said in "R-intro: length of 'ifelse' result" (https://stat.ethz.ch/pipermail/r-devel/2016-September/073136.html), ifelse(condition, a, b) returns a vector of the length of 'condition', even if 'a' or 'b' is longer. On current 'ifelse' cod

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-22 Thread Gabriel Becker
Martin et al., On Tue, Nov 22, 2016 at 2:12 AM, Martin Maechler wrote: > > Note that my premise was really to get *away* from inheriting > too much from 'test'. > Hence, I have *not* been talking about replacing ifelse() but > rather of providing a new ifelse2() > >[ or if_else() if

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-22 Thread Martin Maechler
> Gabriel Becker > on Tue, 15 Nov 2016 11:56:04 -0800 writes: > All, > Martin: Thanks for this and all the other things you are doing to both > drive R forward and engage more with the community about things like this. > Apologies for missing this discussion the first

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-15 Thread Gabriel Becker
All, Martin: Thanks for this and all the other things you are doing to both drive R forward and engage more with the community about things like this. Apologies for missing this discussion the first time it came around and if anything here has already been brought up, but I wonder what exactly yo

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-11-15 Thread Martin Maechler
Finally getting back to this : > Hadley Wickham > on Mon, 15 Aug 2016 07:51:35 -0500 writes: > On Fri, Aug 12, 2016 at 11:31 AM, Hadley Wickham > wrote: >>> >> One possibility would also be to consider a >>> "numbers-only" or >> rather "same type"-only {e.g., >>>

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-15 Thread Hadley Wickham
On Fri, Aug 12, 2016 at 11:31 AM, Hadley Wickham wrote: >> >> One possibility would also be to consider a "numbers-only" or >> >> rather "same type"-only {e.g., would also work for characters} >> >> version. >> >> > I don't know what you mean by these. >> >> In the mean time, Bob

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-12 Thread Hadley Wickham
> >> One possibility would also be to consider a "numbers-only" or > >> rather "same type"-only {e.g., would also work for characters} > >> version. > > > I don't know what you mean by these. > > In the mean time, Bob Rudis mentioned dplyr::if_else(), > which is very relevant, th

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-12 Thread Martin Maechler
Excuse for the delay; I had waited for other / additional comments and reactions (and been distracted with other urgent issues), but do want to keep this thread alive [inline] .. > Duncan Murdoch > on Sat, 6 Aug 2016 11:30:08 -0400 writes: > On 06/08/2016 10:18 AM, Martin Maech

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-08 Thread Martin Maechler
> Uwe Ligges > on Sun, 7 Aug 2016 09:51:58 +0200 writes: > On 06.08.2016 17:30, Duncan Murdoch wrote: >> On 06/08/2016 10:18 AM, Martin Maechler wrote: [.] >>> Of course, an ifelse2() should also be more efficient than >>> ifelse() in typical "ato

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-07 Thread Uwe Ligges
On 06.08.2016 17:30, Duncan Murdoch wrote: On 06/08/2016 10:18 AM, Martin Maechler wrote: Dear R-devel readers, ( = people interested in the improvement and development of R). This is not the first time that this topic is raised. and I am in now state to promise that anything will result from

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-06 Thread Duncan Murdoch
On 06/08/2016 10:18 AM, Martin Maechler wrote: Dear R-devel readers, ( = people interested in the improvement and development of R). This is not the first time that this topic is raised. and I am in now state to promise that anything will result from this thread ... Still, I think the majority

Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-06 Thread Bob Rudis
have you tried seeing if `dplyr::if_else` behaves more to your liking? On Sat, Aug 6, 2016 at 10:20 AM Martin Maechler wrote: > Dear R-devel readers, > ( = people interested in the improvement and development of R). > > This is not the first time that this topic is raised. > and I am in now stat

[Rd] ifelse() woes ... can we agree on a ifelse2() ?

2016-08-06 Thread Martin Maechler
Dear R-devel readers, ( = people interested in the improvement and development of R). This is not the first time that this topic is raised. and I am in now state to promise that anything will result from this thread ... Still, I think the majority among us has agreed that 1) you should never use