Coder Social home page Coder Social logo

nhlscrapr's Introduction

NHLscrapr

Scraper for play by play data from NHL API, using R

This code is written in RStudio, using the jsonlite package. I am just a beginner in R so I am sure many improvements can be made, but as I am writing this I already scraped almost 600 files for the 2015 season without a glitch (knock, knock). I also did a good amount of testing.

Purpose is to read NHLs Game Feed files in JSON one by one, select a subset of headers / variables, organize these and convert them to a csv-file. These files can then be combined in the Windows command line (CMD) with "copy * combined.csv" to a single season file, which on its own can be used in Tableau (or any other tool of choice that reads CSV).

I did run into the issue that apparently some of the files are empty. They have some base information, but there are no plays. these files are not written CSV (in case you are wondering why the list is not complete)

To run the code, make sure to turn on the jsonlite package, set your desired workdirectory, set the names of the gamenumber and gamelinknumber to reflect the year, and run it.

To combine all game csv's intot one file, use Windowns CMD > copy *.csv combined.scv

Any thoughts? Please let me know, here or on twitter @rjweise

nhlscrapr's People

Contributors

rjweise avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.