Displaying 20 results from an estimated 5000 matches similar to: "ifelse() woes ... can we agree on a ifelse2() ?"
2016 Nov 28
0
ifelse() woes ... can we agree on a ifelse2() ?
>>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org>
>>>>> on Sat, 26 Nov 2016 17:14:01 +0000 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(condition, a,
2016 Nov 15
0
ifelse() woes ... can we agree on a ifelse2() ?
Finally getting back to this :
>>>>> Hadley Wickham <h.wickham at gmail.com>
>>>>> on Mon, 15 Aug 2016 07:51:35 -0500 writes:
> On Fri, Aug 12, 2016 at 11:31 AM, Hadley Wickham
> <h.wickham at gmail.com> wrote:
>>> >> One possibility would also be to consider a
>>> "numbers-only" or >>
2017 Nov 04
1
ans[nas] <- NA in 'ifelse' (was: ifelse() woes ... can we agree on a ifelse2() ?)
Removal of
ans[nas] <- NA
from the code of function 'ifelse' in R is not committed (yet). Why?
--------------------------------------------
On Mon, 28/11/16, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
Subject: Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?
Cc: R-devel at r-project.org, maechler at stat.math.ethz.ch
Date: Monday, 28 November, 2016, 10:00
2016 Nov 22
0
ifelse() woes ... can we agree on a ifelse2() ?
>>>>> Gabriel Becker <gmbecker at ucdavis.edu>
>>>>> 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 time it came around and if
2016 Nov 26
3
ifelse() woes ... can we agree on a ifelse2() ?
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' code in R:
* The part
ans[nas] <- NA
2016 Aug 06
0
ifelse() woes ... can we agree on a ifelse2() ?
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 among us has agreed that
>
> 1) you should never use
2016 Aug 07
1
ifelse() woes ... can we agree on a ifelse2() ?
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
>> this thread ...
>>
>> Still, I
2016 Nov 27
1
ifelse() woes ... can we agree on a ifelse2() ?
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(TRUE, yes, no)) # integer
typeof(ifelse(FALSE, yes, no)) # double
As
2016 Nov 15
2
ifelse() woes ... can we agree on a ifelse2() ?
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 you
mean when you want recycling behavior.
Specifically, based on an unrelated discussion with Henrik
2016 Nov 27
0
ifelse() woes ... can we agree on a ifelse2() ?
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 'ifelse'-like functions so far, including from me (that I labeled as
2016 Aug 12
2
ifelse() woes ... can we agree on a ifelse2() ?
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 <murdoch.duncan at gmail.com>
>>>>> on Sat, 6 Aug 2016 11:30:08 -0400 writes:
> On 06/08/2016 10:18 AM, Martin Maechler wrote:
>> Dear
2016 Aug 12
0
ifelse() woes ... can we agree on a ifelse2() ?
> >> 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, thank you Bob!
>
> As I have
2016 Aug 06
4
ifelse() woes ... can we agree on a ifelse2() ?
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 ifelse(test, yes, no)
if you know that length(test) == 1, in which case
if(test) yes
2016 Aug 15
2
ifelse() woes ... can we agree on a ifelse2() ?
On Fri, Aug 12, 2016 at 11:31 AM, Hadley Wickham <h.wickham at gmail.com> 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
2018 May 08
1
Proposed speedup of ifelse
Hugh,
(Note I speak for myself only and not for R-core) Thanks for looking into
this. I think it's great to have community members that are interested in
contributing to R and helping it continue to get better.
And I think, and my local experiments bear out, that using anyNA as a
fastpass condition does allow us to get a significant speedup over what's
in there now. To do so, though, I
2018 May 03
1
Proposed speedup of ifelse
I propose a patch to ifelse that leverages anyNA(test) to achieve an
improvement in performance. For a test vector of length 10, the change
nearly halves the time taken and for a test of length 1 million, there
is a tenfold increase in speed. Even for small vectors, the
distributions of timings between the old and the proposed ifelse do
not intersect.
The patch does not intend to change the
2024 Jan 29
1
strcapture performance when perl = TRUE
I wanted to raise the possibility of improving strcapture performance in
cases where perl = TRUE. I believe we can do this in a non-breaking way
by calling regexpr instead of regexec (conditionally when perl = TRUE).
To illustrate this I've put together a 'proof of concept' function called
strcapture2 that utilises output from regexpr directly (following a very
nice substring approach
2023 Feb 23
1
Palettes {grDevices} - wrong number of colors returned?
On 23/02/2023 4:36 a.m., Sigbert Klinke wrote:
> Hi,
>
> I would have expected that I get always 3 colors as result which is not
> true:
>
> hcl.colors(3, alpha=c(0, 0.5, 1)) # 3 colors
>
> rainbow(3, alpha=c(0, 0.5, 1)) # 3 colors
>
> heat.colors(3, alpha=c(0, 0.5, 1)) # 3 colors
>
> terrain.colors(3, alpha=c(0, 0.5, 1)) # 6 colors
>
>
2018 May 05
0
Bug in profile.nls with algorithm = "plinear"
Dear sirs
It seems like there is a bug in `profile.nls` with `algorithm =
"plinear"` when a matrix is supplied on the right hand side. Here is
the bug and a potential fix
#####
# example where profile.nls does not work with `plinear` but does with
# `default`
require(graphics)
set.seed(1)
DNase1 <- subset(DNase, Run == 1)
x <- rnorm(nrow(DNase1))
f1 <- nls(density ~ b1/(1 +
2023 Feb 23
1
Palettes {grDevices} - wrong number of colors returned?
Duncan,
thanks for your feedback. I just received your response after sending out
mine. You came to the same conclusion. Should I prepare a patch and send
it to you so that you can also have a look? Or view Bugzilla?
Best wishes,
Achim
On Thu, 23 Feb 2023, Duncan Murdoch wrote:
> On 23/02/2023 4:36 a.m., Sigbert Klinke wrote:
>> Hi,
>>
>> I would have expected that I