Data visualization basics
Visualization is one of the most important tools for data science.
It is also a great way to start learning R; when you visualize data, you get an immediate payoff that will keep you motivated as you learn. After all, learning a new language can be hard!
This tutorial will teach you how to visualize data with R’s most popular visualization package, ggplot2
.
The tutorial focuses on three basic skills:
- How to create graphs with a reusable template
- How to add variables to a graph with aesthetics
- How to make different “types” of graphs with geoms
In this tutorial, we will use the core tidyverse packages, including ggplot2
. I’ve already loaded the packages for you, so let’s begin!
These examples are excerpted from R for Data Science by Hadley Wickham and Garrett Grolemund, published by O’Reilly Media, Inc., 2016, ISBN: 9781491910399. You can purchase the book at shop.oreilly.com.