Please consider the following two R statements:
    A =  runif(20, min=-1,max=1)
    ifelse( A < 0, sqrt(-A), A )

The second statement produces the following error message:
    rt(-A) : NaNs produced

I understand that you cannot take the square root of a negative number but I thought the condition A < 0
would take care of that issue. It appears not to be.

What am I missing?

Thanks,
Bob

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to