Re: [R] assumptions about how things are done

2021-10-09 Thread Richard O'Keefe
Colour me confused. if (...) { ... } else { ... } is a control structure. It requires the test to evaluate to a single logical value, then it evaluates one choice completely and the other not at all. It is special syntax. ifelse(..., ..., ...) is not a control structure. It is not special syntax

[R] 2022 John M. Chambers Software Award

2021-10-09 Thread Raymond Wong
Dear R-help listers, The Statistical Computing Section of the American Statistical Association announces the competition for the John M. Chambers Statistical Software Award. In 1998 the Association for Computing Machinery (ACM) presented the ACM Software System Award to John Chambers for the de

Re: [R] assumptions about how things are done

2021-10-09 Thread Jim Lemon
Hi Avi, Definitely a learning moment. I may consider writing an ifElse() for my own use and sharing it if anyone wants it. Jim On Sun, Oct 10, 2021 at 6:36 AM Avi Gross via R-help wrote: > > This is supposed to be a forum for help so general and philosophical > discussions belong elsewhere, or n

Re: [R] How to use ifelse without invoking warnings

2021-10-09 Thread Leonard Mada via R-help
Dear Ravi, I have uploaded on GitHub a version which handles also constant values instead of functions. Regarding named arguments: this is actually handled automatically as well: eval.by.formula((x > 5 & x %% 2) ~ (x <= 5) ~ ., FUN, y=2, x) # [1]  1  4  9 16 25  6 14  8 18 10 eval.by.formul

[R] assumptions about how things are done

2021-10-09 Thread Avi Gross via R-help
This is supposed to be a forum for help so general and philosophical discussions belong elsewhere, or nowhere. Having said that, I want to make a brief point. Both new and experienced people make implicit assumptions about the code they use. Often nobody looks at how the sausage is made. The re

Re: [R] How to use ifelse without invoking warnings

2021-10-09 Thread Leonard Mada via R-help
Dear Ravi, I wrote a small replacement for ifelse() which avoids such unnecessary evaluations (it bothered me a few times as well - so I decided to try a small replacement). ### Example: x = 1:10 FUN = list(); FUN[[1]] = function(x, y) x*y; FUN[[2]] = function(x, y) x^2; FUN[[3]] = function