Chapter 12 Pipes Application
Chapter 12 continues on with pipes, %>%
, which we learned more about last chapter. The first half of the chapter has you recreate the “Reshaping data” code using pipes. Then, you are directed to do specific things with the data like create several graphs, filtering/selecting specific data, and saving your plots.
12.1 Goals
Set working directory, read in data, open and work with R Markdown
Practice coding with pipes
use pipes and
ggplot
to make a bar plotdraw conclusions from your data
make a bar chart of means
make a density plot
save your plots
12.2 Tasks
Task 1: Set-up
At this point you should be familiar with this step. Set your working directory, save your rmd file, load in the tidyverse, and name the three datasets we need when working with the AQ. Complete 12.1.1.
Task 2: Efficient Code
Complete 12.1.2-12.1.4. This is not asking you to do a lot of work, but it is asking you to try something on your own. Please try this, the point isn’t solving the problem, the point is changing the way you think about coding….as nested rather than argument by argument. It should also demonstrate that using pipes correctly makes your work easier and more clean if you practice. If you have problems try the stackoverflow first, but the answers are always at the bottom of the page.
Task 3: Bar plots with summarize
I hope you have noticed this so far, but if you’ve been too focused on coding up to this point the graphs we’ve made have only been frequency distributions. However, we gotta graph way more than just frequency distributions, so 12.1.5 will show you how to create a bar graph of group means.