Astromets Mind: R
Showing posts with label R. Show all posts
Showing posts with label R. Show all posts

Friday, April 1, 2016

How To Quickly Import Fangraphs Stats With R

Let RSelenium scrape the Fangraphs data you want for you

            As Spring Training wraps up, more and more baseball fans start turning to their favorite stat pages to get ready for fantasy baseball season, and Fangraphs has become the standard source for stats. If you take your fantasy baseball seriously and/or you play in a daily fantasy league, you may want to import new data into R daily for research before you make your lineup choices. Unfortunately, while R has several useful packages for scraping data off the web, the ones that seemed obvious to me weren’t ideal for this situation, but I found a solution with the help of the RSelenium package. Below I review how to set-up a Firefox profile to make interacting with RSelenium easier, and then share a basic function for scraping complete datasets from Fangraphs directly into R.
submit to reddit