Batting Location Charts with Vagrant and MySQL

Use R and MySQL together to create batting location charts from large data sets.
4.4 (21 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
4,441 students enrolled
Start Learning Now
  • Lectures 18
  • Length 1 hour
  • Skill Level Intermediate Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 9/2015 English

Course 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.

What are the 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.

What am I going to get from this course?

  • 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.

Who is the target audience?

  • 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.

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Setting up MySQL

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


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


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


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


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


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


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.


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

Section 2: Visualization with R

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


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


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


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


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


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


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


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.


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.


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

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Charles Redmond, Professor at Mercyhurst University

Dr. Charles Redmond is a professor in the Tom Ridge School of Intelligence Studies and Information Science at Mercyhurst University. He has been a member of the Department of Mathematics and Computer Systems at Mercyhurst for 21 years and has recently completed a term as chair of the department. Dr. Redmond received his PhD in mathematics from Lehigh University in 1993 and has published in the Annals of Applied Probability, the Journal of Stochastic Processes and Their Applications, Mathematics Magazine, the College Mathematics Journal, and Mathematics Teacher. In his spare time he enjoys making music and computer generated art, reading, and owning a Clumber Spaniel.

Ready to start learning?
Start Learning Now