From 9cc1ec2f578c72d94302372d27d2d093baaa7fb2 Mon Sep 17 00:00:00 2001 From: Jonathan Page Date: Mon, 3 Oct 2016 02:07:45 -1000 Subject: [PATCH] Grammar (#269) Minor corrections --- visualize.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/visualize.Rmd b/visualize.Rmd index 3009bdc..bedbb32 100644 --- a/visualize.Rmd +++ b/visualize.Rmd @@ -476,7 +476,7 @@ On the x-axis, the chart displays `cut`, a variable from `diamonds`. On the y-ax * __boxplots__ calculate the quartiles of your data and then plot the quartiles as a box. -ggplot2 calls the algorithm that a graph uses to calculate new values a __stat__, which is short for statistical transformation. Each geom in ggplot2 is associated with a default stat that it uses to calculate values to plot. The figure below describes how this process works with `geom_bar()`. +ggplot2 calls the algorithm that a graph uses to calculate new values, a __stat__, which is short for statistical transformation. Each geom in ggplot2 is associated with a default stat that it uses to calculate values to plot. The figure below describes how this process works with `geom_bar()`. ```{r, echo = FALSE, out.width = "100%"} knitr::include_graphics("images/visualization-stat-bar.png") @@ -490,7 +490,7 @@ knitr::include_graphics("images/visualization-stat-point.png") You can learn which stat a geom uses, as well as what variables it computes by visiting the geom's help page. For example, the help page of `geom_bar()` shows that it uses the count stat and that the count stat computes two new variables, `count` and `prop`. -Stats are the most subtle part of plotting because you can't see them directly. ggplot2 applies the transformation and stores the results behind the scenes. You only see impact in the final plot. Generally, you don't need to think about stats: the defaults work away on your behalf to summarise your data as needed for a particular plot. However, there are two cases where you might need to know about it: +Stats are the most subtle part of plotting because you can't see them directly. ggplot2 applies the transformation and stores the results behind the scenes. You only see the impact in the final plot. Generally, you don't need to think about stats: the defaults work away on your behalf to summarise your data as needed for a particular plot. However, there are two cases where you might need to know about them: 1. You might want to override the default stat. In the code below, I change the stat of `geom_bar()` from count (the default) to identity. This lets