Displaying 2 results from an estimated 2 matches for "chkifelse".
2016 Nov 26
3
ifelse() woes ... can we agree on a ifelse2() ?
...?? ans[sel] <- rep(yes, length.out = length(ans))[sel]
* If 'test' is a factor, doing
storage.mode(test) <- "logical"
is not appropriate, but is.atomic(test) returns TRUE. Maybe use
if(!is.object(test))
instead of
if(is.atomic(test)) .
On ifelse-checks.R:
* In function 'chkIfelse', if the fourth function argument names is not "NA.", the argument name is changed, but the function body still uses the old name. That makes error in chkIfelse(ifelseHW) .
A fix:
? ? ? ? if(names(formals(FUN))[[4]] != "NA.") {
? ? ? ? ? ? body(FUN) <- do.call(substitute,...
2016 Nov 28
0
ifelse() woes ... can we agree on a ifelse2() ?
...reasonable cases.
https://gist.github.com/mmaechler/9cfc3219c4b89649313bfe6853d87894#file-ifelse-def-r-L168
Hence my ifelse2() became even a bit longer (but not slower)
working for even more classes of "yes" and "no".
> On ifelse-checks.R:
> * In function 'chkIfelse', if the fourth function argument names is not "NA.", the argument name is changed, but the function body still uses the old name. That makes error in chkIfelse(ifelseHW) .
> A fix:
> ? ? ? ? if(names(formals(FUN))[[4]] != "NA.") {
> ? ? ? ? ? ? body(FUN...