Making Choices

Choice Operators


Create the following variables.

w <- 10.2
x <- 1.3
y <- 2.8
z <- 17.5
dna1 <- "attattaggaccaca"
dna2 <- "attattaggaacaca"
colors <- c("green", "pink", "red")

Use them to print whether or not the following statements are

TRUE or FALSE.

  1. w is greater than 10
  2. "green" is in colors
  3. x is greater than y
  4. 2 * x + 0.2 is equal to y
  5. dna1 is the same as dna2
  6. dna1 is not the same as dna2
  7. w is greater than x, and y is greater than z
  8. x times w is between 13.2 and 13.5
  9. dna1 is longer than 5 bases (use nchar() to figure out how long a string is), or z is less than w * x
[click here for output]