Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

zamorarr/msf

Repository files navigation

Travis-CI Build Status Coverage Status

msf

msf is an R wrapper for the MySportsFeeds API.

There is an official R package provided by MySportsFeeds, but this package differs in the following ways:

  • Provides parse_* functions to convert a JSON list into a tidy dataframe.
  • Provides delay parameter in API calls to execute multiple queries with a delay between them in order to obey rate limits.
  • Provides common defaults for some parameters (ex. uses season = "current") to reduce typing.

These additions have been very helpful for me to use the data effectively in R. Also, when I started this package the official R package had not been released yet.

Install

devtools::install_github("zamorarr/msf")

Usage

To start, make sure you have set the following environment variables set on your computer. Putting them in your .Renviron file is probably the easiest way to do it.

MYSPORTSFEEDS_USER=YOUR_USERNAME
MYSPORTSFEEDS_PASSWORD=YOUR_PASSWORD

Then in R you can query the feeds easily. See the function documentation for a description of the parameters. They should follow the same parameters required to query the official web API.

library(msf)

# Get data
resp <- game_boxscore("nba", "20171027-BRO-NYK")

# You can directly work with the json content represented as a list
json <- resp$content

# Or parse the json list into tidy dataframe
boxscore <- parse_boxscore(json)

Releases

No releases published

Packages

No packages published

Languages