The logical operations work on vectors too. For example, say in the Nile data we wish to know how many years had flows in the extremes, say below 500 or above 1200:
exts <- Nile[Nile < 800 | Nile > 1300]
head(exts)
[1] 1370 799 774 694 701 692
length(exts)
[1] 27
By the way, if this count were our only interest, i.e. we have no further use for exts, we can skip assigning to exts, and do things directly:
In Lesson 8, towards the end:
The logical operations work on vectors too. For example, say in the Nile data we wish to know how many years had flows in the extremes, say below 500 or above 1200: