5.4 Quiz answers
if
works with scalars;ifelse()
works with vectors.When
x
isTRUE
,y
will be3
; whenFALSE
,y
will beNULL
; whenNA
the if statement will throw an error.This
switch()
statement makes use of fall-through so it will return 2. See details in Section 5.2.3.