English subtitles

← Plotting Conditional Summaries - Data Analysis with R

Get Embed Code
6 Languages

Showing Revision 2 created 05/25/2016 by Udacity Robot.

  1. To create this plot, we're going to pass in our variables
  2. to gg plot as usual. We'll set x equal to age,
  3. and y equal to median friend count. And we'll set
  4. data equal to the data frame that we just created. So
  5. pf.fc by age, gender. Now I just need to add
  6. gm line and pass up the color parameter inside the unaesthetic
  7. wrapper. This time the color will take on the value
  8. of gender. This will give me one line for males and
  9. one line for females. Running this code, we get the same
  10. exact plot. Hopefully you're feeling like a data guru at this point.