commit
0d9df81990
|
@ -236,7 +236,7 @@ filter(flights, !(arr_delay > 120 | dep_delay > 120))
|
||||||
filter(flights, arr_delay <= 120, dep_delay <= 120)
|
filter(flights, arr_delay <= 120, dep_delay <= 120)
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that R has both `&` and `|` and `&&` and `||`. `&` and `|` are vectorised: you give them two vectors of logical values and they return a vector of logical values. `&&` and `||` are scalar operators: you give them individual `TRUE`s or `FALSE`s. They're used if `if` statements when programming. You'll learn about that later on.
|
Note that R has both `&` and `|` and `&&` and `||`. `&` and `|` are vectorised: you give them two vectors of logical values and they return a vector of logical values. `&&` and `||` are scalar operators: you give them individual `TRUE`s or `FALSE`s. They're used in `if` statements when programming. You'll learn about that later on.
|
||||||
|
|
||||||
Sometimes you want to find all rows after the first `TRUE`, or all rows until the first `FALSE`. The cumulative functions `cumany()` and `cumall()` allow you to find these values:
|
Sometimes you want to find all rows after the first `TRUE`, or all rows until the first `FALSE`. The cumulative functions `cumany()` and `cumall()` allow you to find these values:
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ ggplot(flights, aes(dep_sched %% 60)) + geom_histogram(binwidth = 1)
|
||||||
ggplot(flights, aes(air_time - airtime2)) + geom_histogram()
|
ggplot(flights, aes(air_time - airtime2)) + geom_histogram()
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Currently `dep_time()` and `arr_time()` are convenient to look at, but
|
1. Currently `dep_time` and `arr_time` are convenient to look at, but
|
||||||
hard to compute with because they're not really continuous numbers.
|
hard to compute with because they're not really continuous numbers.
|
||||||
Convert them to a more convenient representation of number of minutes
|
Convert them to a more convenient representation of number of minutes
|
||||||
since midnight.
|
since midnight.
|
||||||
|
|
Loading…
Reference in New Issue