Exercise

Not!

One last operator to introduce is ! or, Not. You have already seen a similar operator, !=, so you might be able to guess what it does. Add ! in front of a logical expression, and it will flip that expression from TRUE to FALSE (and vice versa).

!TRUE
[1] FALSE

apple <- c(120.00, 120.08, 119.97, 121.88)

!(apple < 121)
[1] FALSE FALSE FALSE  TRUE

The stocks data frame is available for you to use.

Instructions

100 XP
  • Use ! and a relational operator to know when ibm is not above 176.
  • A new vector, missing, has been created, which contains missing data.
  • The function is.na() checks for missing data. Use is.na() on missing.
  • Suppose you are more interested in where you are not missing data. ! can show you this. Use ! in front of is.na() to show positions where you do have data.