How to Visualize Data with R
4.8 (7 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
187 students enrolled

How to Visualize Data with R

Learn R programming and create a data visualization using real weather data
4.8 (7 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
187 students enrolled
Created by Elisabeth Robson
Last updated 1/2020
English
English [Auto]
Current price: $16.99 Original price: $24.99 Discount: 32% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 1.5 hours on-demand video
  • 9 articles
  • 2 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • R programming and data visualization
Requirements
  • Basic programming skills
  • RStudio (will walk through how to get it)
Description

Welcome to How to Visualize Data with R. In this project, join Elisabeth Robson to learn how to use the R programming language and RStudio to visualize data. Elisabeth will take you through building a visualization using data downloaded from the US National Weather Service. You'll learn how to use R to read data from a CSV file, inspect and understand data and data frames, and use the plot() and ggplot() functions to create data visualizations. Along the way you'll learn from the ground up how to use R and RStudio, including how to create and run an R script, basic R data types and values, how to create a scatter plot graph, how linear regression works, and how to install and use an R package.

At the end of the course you'll have completed a data visualization of the weather data, and have some new skills you can apply to your own data too.

Who this course is for:
  • Beginner R students
  • Beginner programming students
  • Students curious about data visualization
  • Students interested in climate change
Course content
Expand all 23 lectures 01:26:17
+ Get set up
5 lectures 15:27

Welcome to How to Visualize Data with R. In this project, join Elisabeth Robson to learn how to use the R programming language and RStudio to visualize data. Elisabeth will take you through building a visualization using data downloaded from the US National Weather Service. You'll learn how to use R to read data from a CSV file, inspect and understand data and data frames, and use the plot() and ggplot() functions to create data visualizations. Along the way you'll learn from the ground up how to use R and RStudio, including how to create and run an R script, basic R data types and values, how to create a scatter plot graph, how linear regression works, and how to install and use an R package.

At the end of the course you'll have completed a data visualization of the weather data, and have some new skills you can apply to your own data too.

Preview 03:25

To get started with this project, we first need to download and install R and RStudio. It's easy! This video will take you through the steps.

Preview 03:49

We have R and RStudio installed, so now it's time to get the data. We'll be using data downloaded from the US National Weather Service. We're going to use data for Phoenix, AZ but feel free to pick data for another city if you want---you may have to adjust the years, depending on how much data the NWS has for that city, but otherwise, the project is the same for other city data.

You can download the CSV resource file directly (Resources) or get it from weather.gov

Preview 05:16

Now that we have the data downloaded and in CSV format, it's time to check out the data a little more closely. Follow along as we take a look at the data to understand it.

Inspect the Data
02:17
Do the Work: Analyze the Data
00:40
+ Write the Code
12 lectures 52:35

The first thing we need to do to work with the data in R, it to read it in with a script. In this lesson you'll learn how to read data using R, and how to run your first R program.

Read the Data
09:42

We've read in some data, so now it's time to talk about how R thinks about data and other kinds of values. R has some types you'll find familiar, like strings, booleans, and ints; it also has types you may not be as familiar with like vectors, lists, and data frames. In this lesson we'll talk about some of these types of values.

Data Types and Values
06:32
Do the Work: Write code to get the January temperatures
00:16
Do the Work Solution: Write code to get the January temperatures
00:02

Now that we have the years in the variable years; and the January average temperatures in the variable month; it's time to plot the data. In this lesson you'll learn how to use the plot() function to create a scatter plot graph in R.

Plot the Data
08:45

We've created a scatter plot graph of our data, which helps us see how January average temperatures vary in Phoenix, AZ. But it's still difficult to detect any kind of trend in the data (are average temperatures in January getting warmer? cooler? staying about the same?). In this lesson, we'll use R to create a trend line with a linear regression model. You'll learn what a linear regression model is, and how to make one with R.

Create a Trend Line with a Linear Model Function
07:45
Do the Work: Practice creating a trend line
00:08

Linear models can be used in two different ways: for existing observations (observed data from the past that is recorded, like the January data we are using for Phoenix, AZ), a linear model can tell us if there's a trend in the data.

Another way we can use a linear model is to make predictions about the future. We can see that the trend line for January is going up, meaning January average temperatures in Phoenix are getting warmer. So can we make a prediction that next January will be warmer than this January? Hmm. In this lesson you'll learn about two ways we can evaluate the predictive power of our model.

How Good is our Model?
05:46
Do the Work: Practice analyzing the Model
00:18

We have 12 months of data for Phoenix, so wouldn't it be nice if we could generate all the scatter plot graphs with our code at once so we don't have change the code to create a graph for a different month? In this lesson you'll learn how for loops work in R, and use a for loop to generate the graphs for all the months of the year.

Plot the Data in a Loop
07:51

In the previous lesson you learned how to plot all the graphs at once using a for loop. It would be even better if we could see all the graphs on one page in the Plots pane so we could compare the temperatures for the months. In this lesson you'll learn how to use the par() function to control how the plots are displayed in the plots pane.

Display all the Graphs on the Same Page
05:11
Do the Work: Create plot graphs for another city
00:18
+ Install and Use an R Package
4 lectures 15:53

The R programming language is popular among data scientists, statisticians, and mathematicians, and there are a huge number of packages available containing pre-written functions to help you do all kinds of things in R, so you don't have to write all that code yourself.

In this lesson, we'll install the ggplot2 package, which comes with a ggplot() function we can use to create scatter plots.

Use the ggplot2 package
09:07
Do the Work: Modify the y axis range
00:22

This is the last step of our code! In this lesson, we're going to plot the max average January temperature and min average January temperature in a bright red color so those two points stand out in the graph. You'll learn how to create a new data frame from the min and max data points (the temperatures and the years), and create a new layer in the plot with that data frame.

Once you've completed this lesson you'll be done with the code for the course.

Plot the min and max temperatures
06:14
Do the Work: Use ggplot() to graph data for another city
00:10
+ Wrap Up
2 lectures 02:20

You've completed the course! Well done. Along the way you learned about R and RStudio, about linear regression models, and how to create scatter plot graphs from temperature data. In this lesson we wrap up the course.

Gain some Insight
02:17
Download the files
00:03