Creating Baseball Graphics Using R

Ever wanted to create “heat maps” like this. Or line graphs like this. Now here’s you chance!

These graphics are made through the freely available software simply called R. A powerful software used by scientists, R can be a daunting program to use with its command-line interface that might not be too friendly to those who are justing getting by with Microsoft Excel. Plus there is a lot of code to learn in order to do the most basic functions. I am certain there are many people out there who are willing to learn how to make these graphics with R but they don’t know where to start. This is where I come in.

Starting this week, I will write a series of tutorial articles here at THT Live explaining how to use the R system, import data, write code, and make those awesome graphics. Most of the graphs and functions I will use will pertain to the very popular pitch f/x from MLB Advanced Media. A large amount of pitch f/x data is easy to come by now using the awesome web tool by Joe Lefkowitz so no database required. Also note that the series is not called “Pitch f/x Graphics” since I will try to find some things to do that don’t involve pitch f/x data. Another thing to note is that I am no R expert and I have only used it for baseball data. There may be easier ways to do certain things. But this also means that I shouldn’t be too overly complicated either. If you have any ideas of what I should cover over the course of the series, please comment away or shoot me an email.

Before you leave, let’s start with the most basic step of this process by downloading the R software. Go to http://cran.r-project.org/ and click your Operating System (I will be using Windows). For Windows users, click the base package. Mac users, click the file named R-2.12.0.pkg. And if you are using Linux, download the tar.gz file on the homepage. After the file is downloaded, follow the instructions for installation. And now your done.

For next time, I will go over the basic interface of the R software and how to download packages.


3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Albert Lyu
13 years ago

Looking forward to this. If even a fraction of the online baseball community can learn the basics of R, we would have all sorts of awesome heat map analysis.

Sam
13 years ago

I am really excited for this.  R is a really awesome software that not enough people know how to use.  Encouraging more to learn it will make everyone better off.

chisoxpurdue
13 years ago

I am glad for this.  I have dabbled in R a little for Statistical and Econometric Methods in Civil Engineering (transportation).  These tutorials will be very helpful for both my baseball analysis and graduate research.