fixed three typos in visualize.Rmd (#180)

This commit is contained in:
Terence Teo 2016-07-23 14:48:18 -04:00 committed by Hadley Wickham
parent 926c260a67
commit 0c65570bb4
1 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@
> "The simple graph has brought more information to the data analysts mind
> than any other device." --- John Tukey
This chapter will teach you how to visualize your data ggplot2. R has several systems for making graphs, but ggplot2 is one of the most elegant and most versatile. ggplot2 implements the __grammar of graphics__, a coherent system for describing and building graphs. With ggplot2, you can do more faster by learning one system and applying it in many places.
This chapter will teach you how to visualize your data using ggplot2. R has several systems for making graphs, but ggplot2 is one of the most elegant and most versatile. ggplot2 implements the __grammar of graphics__, a coherent system for describing and building graphs. With ggplot2, you can do more faster by learning one system and applying it in many places.
### Prerequisites
@ -231,13 +231,13 @@ ggplot(data = mpg)
If you're still stuck, try the help. You can get help about any R function by runnning `?function_name` in the console, or selecting the function name and pressing F1 in RStudio. Don't worry if the help doesn't seem that helpful - instead skip down to the examples and look for code that matches what you're trying to do.
If that doesn't help, carefully read the error message. Sometimes the answer will be buried there! But when you're new to R, the answer might be but you don't yet know how to understand it. Another great tool is google: trying googling the error message, as it's likely someone else has had the same problem, and have gotten help online.
If that doesn't help, carefully read the error message. Sometimes the answer will be buried there! But when you're new to R, the answer might be in the error message but you don't yet know how to understand it. Another great tool is google: trying googling the error message, as it's likely someone else has had the same problem, and have gotten help online.
## Facets
One way to add additional variables is with aesthetics. Another way, particularly useful for categorical variables, is to split your plot into __facets__, subplots that each display one subset of the data.
To facet you plot by a single variable, use `facet_wrap()`. The first argument of should be a formula, which you create with `~` followed by a variable name (here "formula" is the name of a data structure in R, not a synonym for "equation"). The variable that you pass to `facet_wrap()` should be discrete.
To facet your plot by a single variable, use `facet_wrap()`. The first argument of `facet_wrap()` should be a formula, which you create with `~` followed by a variable name (here "formula" is the name of a data structure in R, not a synonym for "equation"). The variable that you pass to `facet_wrap()` should be discrete.
```{r}
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +