Creating a Baseball Database with baseballDBR
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
My original motivation to write the baseballDBR
package for R was to provide a quick and easy way to have access to Sean Lahman’s Baseball Database. The Lahman
package has been around for several years, and is a great resource, however it lacks consistant updates. Also, the CRAN repository has limits on how large data packages can be, and the Lahman
package is currently pushing that limit.
The answer was an “open-data” format that is maintained by the Chadwick Bureau’s Baseball Databank, which is based on Sean Lahman’s database, version 2015-01-24, but has additinal tables aggregated from Retrosheet data.
For further details, see the GitHub page for the baseballDBR
package. In the meantime, we’ll spin through a few lines of code that will quickly get us up and running.
The following is based on the assumption we have an empty Postgres database called “lahman.” If you prefer another database, the following method should also work with MySQL and the RMySQL
package.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.