matloff / fasteR

Fast Lane to Learning R!
958 stars 154 forks source link

Lesson 8 Nile Values typos #20

Closed yello-there closed 1 year ago

yello-there commented 1 year ago

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:

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:

length(Nile[Nile < 800 | Nile > 1300]) [1] 27

matloff commented 1 year ago

Thanks!