Giter Club home page Giter Club logo

mysportsfeeds-r's Introduction

mysportsfeeds-r

MySportsFeeds R Wrapper brought to you by @MySportsFeeds.

Makes use of the MySportsFeeds API - a flexible, developer-friendly Sports Data API.

Free for Non-Commercial Use.

##Install

devtools::install_github("MySportsFeeds/mysportsfeeds-r")

##Usage

If you haven't signed up for API access, do so here https://www.mysportsfeeds.com

To authenticate (v1.x):

library(mysportsfeedsR)
authenticate_v1_x('<your-api-key>', '<your-account-password>')

To authenticate (v2.0): This will assume the expected v2.0 password of "MYSPORTSFEEDS"

library(mysportsfeedsR)
authenticate_v2_x('<your-api-key>')

Start making requests, specifying: league, season, feed, format, and any other applicable params for the feed

Example (v1.x): Get all NBA 2016-2017 regular season gamelogs for Stephen Curry, in JSON format

gamelogs <- msf_get_results(version='1.2',league='nba',season='2016-2017-regular',feed='player_gamelogs',params=list(player='stephen-curry'))

Example (v1.x): Get all NFL 2015 regular season seasonal stats totals for all Dallas Cowboys players, in XML format

season_stats <- msf_get_results(version='1.2',league='nfl',season='2015-regular',feed='cumulative_player_stats',params=list(team='dallas-cowboys'))

Example (v1.x): Get full game schedule for the MLB 2016 playoff season, in CSV format

full_sched <- msf_get_results(version='1.2',league='mlb',season='2016-playoff',feed='full_game_schedule')

Example (v2.0): Get all NBA 2016-2017 regular season gamelogs for Stephen Curry, in JSON format

gamelogs <- msf_get_results(version='2.0',league='nba',season='2016-2017-regular',feed='seasonal_player_gamelogs',params=list(player='stephen-curry'))

Example (v2.0): Get all NFL 2015 regular season seasonal stats totals for all Dallas Cowboys players, in XML format

season_stats <- msf_get_results(version='2.0',league='nfl',season='2015-regular',feed='seasonal_player_stats',params=list(team='dallas-cowboys'))

Example (v2.0): Get full game schedule and scores for the MLB 2016 playoff season, in CSV format

full_sched <- msf_get_results(version='2.0',league='mlb',season='2016-playoff',feed='seasonal_games')

That's it! Enjoy all the data you can eat!

mysportsfeeds-r's People

Contributors

bradbarkhouse avatar jcdepth avatar znmeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysportsfeeds-r's Issues

authenticate_v2_x doesn't load

When I library(mysportsfeedsR), only the two functions load:

> ls("package:mysportsfeedsR")
 "authenticate_v1_x" "msf_get_results" 

It doesn't load the v2 authenticate function. I can work around by just copying it from the github and using plain.

msf_get_results() - Error: lexical error: invalid char in json text.

Hi,
I keep getting the following error when the run the msf_get_results function. I'm not sure what is causing it.

full_sched <- msf_get_results(version='1.1',league='mlb',season='2016-playoff',feed='full_game_schedule')

Error
No encoding supplied: defaulting to UTF-8.
Error: lexical error: invalid char in json text.
<title>Authe
(right here) ------^

Error while installing wrapper in Rstudio

Hi, noticed an error while installing the wrapper, I believe it is because the authenticate_v1_0 was renamed to authenticate_v1_x?

Error: package or namespace load failed for ‘mysportsfeedsR’ in namespaceExport(ns, exports):
undefined exports: authenticate_v1_0
Error: loading failed
Execution halted
ERROR: loading failed

  • removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/mysportsfeedsR’
    Installation failed: Command failed (1)

Can't open the RStudio project file

I get the following error when I try to open the RStudio project file mysportsfeedsR.Rproj
screenshot from 2018-08-26 21-45-50

It looks like you have the package version in the Version parameter of mysportsfeedsR.Rproj

Version: 2.0

RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default

That value needs to be the *RStudio' version, not the version of the package. I can open a pull request if you want.

'.MySportsFeedsEnv' does not appear to be initialized

> library("mysportsfeedsR", lib.loc="~/R/x86_64-pc-linux-gnu-library/3.4")
> authenticate_v1_0("znmeb", "notmyrealpassword")
Error in .MySportsFeedsEnv$data$username <- username : 
  object '.MySportsFeedsEnv' not found
> 

Should there be some code to create .MySportsFeedsEnv if it doesn't exist?

Error: parse error: premature EOF when looping

I'm getting the following error when looping through dates to download daily team gamelogs.

imagen

Each time I execute the loop it downloads one date further. So this is the 4th time I run it in a row. If I run it again I can download 20171020 games but will crash in 20171021 and so on.

Not sure where this is coming from.

Windows 10.
R 3.5.1

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.