[1] TRUE
Making choices choice operators (solution)
NoteExercise
Create the following variables.
w <- 10.2
x <- 1.3
y <- 2.8
z <- 17.5
colors <- c("red", "blue", "green")
masses <- c(45.2, 36.1, 27.8, 81.6, 42.4)
dna1 <- "attattaggaccaca"
dna2 <- "attattaggaacaca"Use them to print whether or not the following statements are TRUE or FALSE.
wis greater than 10"green"is incolorsxis greater thany- Each value in
massesis greater than 40. - 2 *
x+ 0.2 is equal toy dna1is the same asdna2dna1is not the same asdna2wis greater thanx, oryis greater thanzxtimeswis between 13.2 and 13.5- Each mass in
massesis between 30 and 50.
CautionOutput solution
wis greater than 10
- Is “green” in
colors
[1] TRUE
xis greater thany
[1] FALSE
- Each value in
massesis greater than 40.
[1] TRUE FALSE FALSE TRUE TRUE
- 2 *
x+ 0.2 is equal toy
[1] FALSE
dna1is the same asdna2
[1] FALSE
dna1is not the same asdna2
[1] TRUE
wis greater thanx, oryis greater thanz
[1] TRUE
xtimeswis between 13.2 and 13.5
[1] TRUE
- Each mass in
massesis between 30 and 50.
- Each mass in
[1] TRUE TRUE FALSE FALSE TRUE