[R] assumptions about how things are done
Greg Minshall
m|n@h@|| @end|ng |rom um|ch@edu
Sun Oct 10 10:18:13 CEST 2021
hi, Richard,
> ifelse(..., ..., ...) is not a control structure. It is not special
> syntax. It is a normal function call, and it evaluates its arguments
> and expands them to a common length just like "+" or, more to the
> point, just like "&".
>
> So why do we have people expecting a normal function call to do
> special control structure magic?
>
> Leaving aside the extending-to-a-common-length part, it's
> ifelse <- function (test, true.part, false.part) {
> false.part[test] <- true.part[test]
> false.part
> }
>
> Why is it so hard to understand that there is nothing special to
> understand here?
i wonder if possibly because features like non-standard evaluation lead
many of us to conclude there may/should/could be magic at all levels?
cheers, Greg
More information about the R-help
mailing list