10.4 Missing values

2 options to deal with weird values:

  • Drop the entire row. <– probably don’t do this
  • Replace bad data with NA.
diamonds2 <- diamonds %>% 
  mutate(y = ifelse(y < 3 | y > 20, NA, y))
  • {ggplot2} will give a warning when values are missing, can suppress with na.rm = TRUE.