Making Choices

Choice Operators


Create the following variables.

w <- 10.2
x <- 1.3
y <- 2.8
z <- 17.5
dna1 <- "attattaggaccaca"
dna2 <- "attattaggaacaca"

Use them to print whether or not the following statements are

TRUE or FALSE.

  1. w is greater than 10
  2. w + x is less than 15
  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. The number of occurrences of the base t is the same in dna1 and dna2

    Use str_count() from the stringr package. You’ll need to install this package before using it and will also want to familiarize yourself with str_length().

  8. w is greater than x, and y is greater than z
  9. x times w is between 13.2 and 13.5
  10. dna1 is longer than 5 bases, or z is less than w * x
  11. The combined length of dna1 and dna2 is greater than or equal to 30
  12. (w + x + y) divided by the logarithm (base 10) of 100 is equal to 7.15
  13. The GC content (which is always a percentage) of dna1 is not the same as the GC content of dna2
[click here for output]