[1] TRUE FALSE FALSE TRUE TRUE
Making choices choice operators vectors (solution)
NoteExercise
Create the following variables.
masses <- c(45.2, 36.1, 27.8, 81.6, 42.4)
counts <- c(26, 20, 12, 32, 16)
heights <- c(5.6, 3.9, NA, 8.6, 39.2)Use them to print whether or not the following statements are TRUE or FALSE.
- Each value in
massesis greater than 40. - Each mass in
massesis between 30 and 50. - Each value in
countsis not equal to 26. - Either the value in
massesis greater than 42 or the value incountsis less than 20. - Each value in
heightsisNA. - Each value in
heightsis greater than 6.
CautionOutput solution
- Each value in
massesis greater than 40.
- Each mass in
massesis between 30 and 50.
[1] TRUE TRUE FALSE FALSE TRUE
- Each value in
countsis not equal to 26.
[1] FALSE TRUE TRUE TRUE TRUE
- Either the value in
massesis greater than 42 or the value incountsis less than 20.
[1] TRUE FALSE TRUE TRUE TRUE
- Each value in
heightsisNA.
[1] FALSE FALSE TRUE FALSE FALSE
- Each value in
heightsis greater than 6.
[1] FALSE FALSE NA TRUE TRUE