Lecture Ticket 6

Reading

Read the following sections of IFDAR.

  • Chapter 4: sections 4.7, 4.8 and 4.9

Questions

  1. You learned about comparison and logical operators in the reading. In R, what is the operator for each of the following:
    1. equality,
    2. greater than,
    3. greater than or equal to,
    4. not equal to,
    5. or,
    6. and.
  2. Consider the following vector:
x <- 1:10
x
 [1]  1  2  3  4  5  6  7  8  9 10

What does the following do to x?

x[x < 5] <- 0