Change `data set` to `dataset` (#1282)

- It changes `data set(s)` to `dataset(s)` for consistency, throughout the book.
- It adds `# Left` and `# Right` comments for similar side-by-side plots.
This commit is contained in:
Zeki Akyol 2023-02-14 16:32:09 +03:00 committed by GitHub
parent 61a4ce719d
commit 5cfe902d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 11 deletions

View File

@ -774,11 +774,13 @@ Compare the following two plots:
#| fig-height: 3
#| message: false
# Left
ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point(aes(color = class)) +
geom_smooth() +
coord_cartesian(xlim = c(5, 7), ylim = c(10, 30))
# Right
mpg |>
filter(displ >= 5, displ <= 7, hwy >= 10, hwy <= 30) |>
ggplot(aes(x = displ, y = hwy)) +
@ -799,9 +801,11 @@ For example, if we extract two classes of cars and plot them separately, it's di
suv <- mpg |> filter(class == "suv")
compact <- mpg |> filter(class == "compact")
# Left
ggplot(suv, aes(x = displ, y = hwy, color = drv)) +
geom_point()
# Right
ggplot(compact, aes(x = displ, y = hwy, color = drv)) +
geom_point()
```
@ -817,12 +821,14 @@ x_scale <- scale_x_continuous(limits = range(mpg$displ))
y_scale <- scale_y_continuous(limits = range(mpg$hwy))
col_scale <- scale_color_discrete(limits = unique(mpg$drv))
# Left
ggplot(suv, aes(x = displ, y = hwy, color = drv)) +
geom_point() +
x_scale +
y_scale +
col_scale
# Right
ggplot(compact, aes(x = displ, y = hwy, color = drv)) +
geom_point() +
x_scale +

View File

@ -57,7 +57,7 @@ Visualizations can surprise you, and they don't scale particularly well because
**Models** are complementary tools to visualization.
Once you have made your questions sufficiently precise, you can use a model to answer them.
Models are a fundamentally mathematical or computational tool, so they generally scale well.
Even when they don\'t, it\'s usually cheaper to buy more computers than it is to buy more brains!
Even when they don't, it's usually cheaper to buy more computers than it is to buy more brains!
But every model makes assumptions, and by its very nature a model cannot question its own assumptions.
That means a model cannot fundamentally surprise you.

View File

@ -224,7 +224,7 @@ In R, `%/%` does integer division and `%%` computes the remainder:
1:10 %% 3
```
Modular arithmetic is handy for the flights dataset, because we can use it to unpack the `sched_dep_time` variable into `hour` and `minute`:
Modular arithmetic is handy for the `flights` dataset, because we can use it to unpack the `sched_dep_time` variable into `hour` and `minute`:
```{r}
flights |>