What is the difference between &&
and &
in R?
a) Both are the same
b)
&&
is for element-wise comparison, and &
is for logical ANDc)
&
is for element-wise comparison, and &&
is for logical ANDd)
&&
is faster than &
Answer:
c)
&
is for element-wise comparison, and &&
is for logical ANDExplanation:
In R, &
performs element-wise comparison, while &&
evaluates the first element only in a logical AND operation.