On Mon, 22 May 2006, Gabor Grothendieck wrote:
> Due to lazy evaluation, I don't think a and b are fully evaluated:
>
>> ifelse(1, a <- 1, b <- 2)
> [1] 1
>> a
> [1] 1
>> b
> Error: object "b" not found
yes. If you look at the code for ifelse() it evaluates the second argument
if any test values are TRUE and the third argument if any test values are
FALSE, so in the scalar case it does not evaluate both arguments.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
[EMAIL PROTECTED] University of Washington, Seattle
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html