Did I mention that we can use vectors to subset other vectors! When we subset vectors using logical vectors of the same length, only the elements corresponding to the TRUE values are extracted. Hopefully, light bulbs are starting to go off in your head. If we wanted to extract only the legitimate non-NA digits from Jenny's number, we can do it as follows:
> messy.vector[!is.na(messy.vector)]  8 6 7 5 3 0 9
This is a very critical trait of R, so let's take our time understanding it; this idiom will come up again and again throughout this book.
The logical vector that yields TRUE when an NA value occurs in messy.vector (from is.na()) is then negated (the whole thing) by the negation operator, !. The resultant vector ...