Batting Location Charts with Vagrant and MySQL
4.5 (82 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.
9,598 students enrolled

Batting Location Charts with Vagrant and MySQL

Use R and MySQL together to create batting location charts from large data sets.
4.5 (82 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.
9,598 students enrolled
Created by Charles Redmond
Last updated 9/2015
English
English [Auto-generated]
This course includes
  • 1 hour on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What you'll learn
  • install MySQL on a Ubuntu machine.
  • perform basic administrative tasks in MySQL.
  • use the vi program to edit the MySQL configuration file.
  • perform port-forwarding with Vagrant.
  • scrape hit location data from PITCHf/x.
  • query MySQL from R.
Requirements
  • Students should have R and RStudio installed.
  • Students should also have VirtualBox and Vagrant installed.
  • It would be best if students have gone through my previous three courses in baseball analytics. This may not, however, be completely necessary.
Description

This course is about working with large sets of PITCHf/x data to create batting location charts. We use R to scrape and visualize the data and MySQL to store the data. The course includes lessons on how to install a virtual Ubuntu machine, how to install MySQL, how to perform basic MySQL administrative tasks, and how to connect R and MySQL.

It would be best if you have some knowledge of R and ggplot. This can be obtained through my previous three courses in baseball analytics. However, it might be possible to follow along without this.

At a relaxed pace, the course should take about two weeks to complete.

Who this course is for:
  • This course is for those who want to learn how to create a hit location chart from PITCHf/x data.
  • The course is also for those who wish to know a little about working with R and MySQL together.
  • The course is NOT for complete beginners in R.
Course content
Expand all 18 lectures 01:05:19
+ Setting up MySQL
8 lectures 26:15

In this lecture, I briefly discuss how the course will unfold.

Introduction
01:03

This is a review of the process of installing an Ubuntu virtual machine.

Creating the Virtual Machine
01:49

After viewing this lecture, you will be able to install MySQL.

Installing MySQL
02:39

After viewing this lecture, you will be able to login and logout of MySQL.

Logging in and out of MySQL
01:13

After viewing this lecture, you will be able to create a user in MySQL.

Creating a User
06:41

After viewing this video, you will be able to grant user privileges in MySQL.

Granting Privileges
02:12

After viewing this lecture, you will be able to use the vi program to edit the MySQL configuration file to allow MySQL to accept requests from all IP addresses.

Changing the Bind Address
05:26

After viewing this lecture, you will be able to forward ports via Vagrant.

Forwarding the Port
05:12
+ Visualization with R
10 lectures 39:04

In this lesson, I show you how to load the packages you will need to visualize the hit locations in R.

Loading the R Packages
01:56

After viewing this lecture, you will be able to scrape hit location data from PITCHf/x.

Scraping the Data
05:32

In this lecture, we get acquainted with the data we have stored in MySQL.

Investigating the Tables
02:18

In this lecture, we decide what information we want to extract from our database into R.

Deciding What Information We Want
02:42

After viewing this lecture, you will be able to query a MySQL database from R.

Making the Query
01:45

In this lecture, we modify the data we extracted from MySQL to make our visualization task easier.

Modifying the Data Frame
05:40

In this lecture, we build the foundation of our plot, visualizing only the locations of where the hits were fielded.

Beginning the Plot
03:56

In this lecture, we enhance the plot by indicating whether each batted baseball was a home run, single, double, or a non-hit. We do this by utilizing the color, shape, and size parameters.

Enhancing the Plot
06:48

After viewing this lecture, you will be able to delete a MySQL database. We will also scrape a season's worth of PITCHf/x data and store it in MySQL.

Getting More Data
03:09

In this lecture we put everything together and apply what we've learned to a larger data set.

Putting It All Together
05:18