parent
4a3b6d0640
commit
cca1cd4e07
|
@ -118,7 +118,7 @@ In simple cases, as above, this will be a single existing function.
|
||||||
This is a pretty special feature of R: we're passing one function (`median`, `mean`, `str_flatten`, ...) to another function (`across`).
|
This is a pretty special feature of R: we're passing one function (`median`, `mean`, `str_flatten`, ...) to another function (`across`).
|
||||||
This is one of the features that makes R a functional programming language.
|
This is one of the features that makes R a functional programming language.
|
||||||
|
|
||||||
It's important to note that we're passing this function to `across()`, so `across()` can call it, not calling it ourselves.
|
It's important to note that we're passing this function to `across()`, so `across()` can call it; we're calling it ourselves.
|
||||||
That means the function name should never be followed by `()`.
|
That means the function name should never be followed by `()`.
|
||||||
If you forget, you'll get an error:
|
If you forget, you'll get an error:
|
||||||
|
|
||||||
|
|
|
@ -383,8 +383,6 @@ ggplot(mpg, aes(x = displ, y = hwy)) +
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
(You'll learn how `filter()` works in the chapter on data transformations: for now, just know that this command selects only the subcompact cars.)
|
|
||||||
|
|
||||||
Geoms are the fundamental building blocks of ggplot2.
|
Geoms are the fundamental building blocks of ggplot2.
|
||||||
You can completely transform the look of your plot by changing its geom, and different geoms can reveal different features of your data.
|
You can completely transform the look of your plot by changing its geom, and different geoms can reveal different features of your data.
|
||||||
For example, the histogram and density plot below reveal that the distribution of highway mileage is bimodal and right skewed while the boxplot reveals two potential outliers.
|
For example, the histogram and density plot below reveal that the distribution of highway mileage is bimodal and right skewed while the boxplot reveals two potential outliers.
|
||||||
|
|
|
@ -639,7 +639,7 @@ We won't explain `sd()` here since you're probably already familiar with it, but
|
||||||
|
|
||||||
We can use this to reveal a small oddity in the `flights` data.
|
We can use this to reveal a small oddity in the `flights` data.
|
||||||
You might expect the spread of the distance between origin and destination to be zero, since airports are always in the same place.
|
You might expect the spread of the distance between origin and destination to be zero, since airports are always in the same place.
|
||||||
But the code below makes it looks like one airport, [EGE](https://en.wikipedia.org/wiki/Eagle_County_Regional_Airport), might have moved.
|
But the code below reveals a data oddity for airport [EGE](https://en.wikipedia.org/wiki/Eagle_County_Regional_Airport):
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
flights |>
|
flights |>
|
||||||
|
@ -773,6 +773,7 @@ For example:
|
||||||
|
|
||||||
3. Create a plot to further explore the adventures of EGE.
|
3. Create a plot to further explore the adventures of EGE.
|
||||||
Can you find any evidence that the airport moved locations?
|
Can you find any evidence that the airport moved locations?
|
||||||
|
Can you find another variable that might explain the difference?
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue