Lahman R Package


A resource to easily pull baseball stats.

If there's one sport that is statistics heavy, its baseball. But harnessing its stats doesn't need to be difficult. Using this Lahman R package, journalists can easily import data from the famed Lahman baseball database.

The package provides the tables from the Lahman database as a set of R data.frames. It uses the data on pitching, hitting and fielding performance and other tables from 1871 through 2015, as recorded in the 2016 version of the database.

By providing a means to pull the Lahman data into R, Kris Eberwein shows how the package assists journalists hoping to work with baseball data.

"The R package is able to pull up the tables into R dataframes quickly and without the need for a database connection," he writes.

"You can easily modify functions as well as add your own and have them ready to go in your R environment."

To help users navigate the data, the package also includes full documentation examples for all data tables. The most recent update also includes a rewrite of the documentation to allow for the extensive use of dplyr for data manipulation and ggplot2 for graphics.

Visit the package's site here.

Image: marc falardeau.