Q. Which of the following R code can be used to avoid numeric problems such as taking the logarithm of a negative number?
β
Correct Answer: (B)
if( any(x <= 0) ) y <- log(1+x) else y <- log(x)
You must be Logged in to update hint/solution