In: Computer Science
Here we require that if the first condition in predicate is evaluated to false, we shhould simply return false & not evaluate sqrt which would lead to warning. Thus, we want the conjunction operator to support short circuiting. In R, however logical operator '&' does not support circuiting but relational operator '&&' does, so we simply need to replace & with && in the given code.
testValue <-7
(testValue > 0) && (sqrt(testValue) < 5)
testValue <--7
(testValue > 0) && (sqrt(testValue) < 5)