Two changes suggested by Toshi (#550)

1. Adds a select() call when exploring diamonds sizes to ensure that the anomalous y variable appears on the page of the printed book (where it is discussed).
2. Adds message = FALSE to suppress "Loading required package: methods" message.
This commit is contained in:
Garrett Grolemund 2017-05-03 08:44:34 -04:00 committed by Hadley Wickham
parent 7494ea1c01
commit 881a900303
1 changed files with 2 additions and 1 deletions

View File

@ -190,6 +190,7 @@ old <- options(tibble.print_max = 10, tibble.print_min = 10)
```{r} ```{r}
unusual <- diamonds %>% unusual <- diamonds %>%
filter(y < 3 | y > 20) %>% filter(y < 3 | y > 20) %>%
select(price, x, y, z) %>%
arrange(y) arrange(y)
unusual unusual
``` ```
@ -458,7 +459,7 @@ But using transparency can be challenging for very large datasets. Another solut
`geom_bin2d()` and `geom_hex()` divide the coordinate plane into 2d bins and then use a fill color to display how many points fall into each bin. `geom_bin2d()` creates rectangular bins. `geom_hex()` creates hexagonal bins. You will need to install the hexbin package to use `geom_hex()`. `geom_bin2d()` and `geom_hex()` divide the coordinate plane into 2d bins and then use a fill color to display how many points fall into each bin. `geom_bin2d()` creates rectangular bins. `geom_hex()` creates hexagonal bins. You will need to install the hexbin package to use `geom_hex()`.
```{r, fig.asp = 1, out.width = "50%", fig.align = "default"} ```{r, fig.asp = 1, out.width = "50%", fig.align = "default", message = FALSE}
ggplot(data = smaller) + ggplot(data = smaller) +
geom_bin2d(mapping = aes(x = carat, y = price)) geom_bin2d(mapping = aes(x = carat, y = price))