Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mbjoseph/bbr

R package to scrape data from basketball-reference.com
https://github.com/mbjoseph/bbr

basketball basketball-reference sports sports-data

Last synced: about 1 month ago
JSON representation

R package to scrape data from basketball-reference.com

Awesome Lists containing this project

README

        

---
output: github_document
---

# bbr: basketball-reference data in R

[![Travis-CI Build Status](https://travis-ci.org/mbjoseph/bbr.svg?branch=master)](https://travis-ci.org/mbjoseph/bbr)
[![Coverage Status](https://img.shields.io/codecov/c/github/mbjoseph/bbr/master.svg)](https://codecov.io/github/mbjoseph/bbr?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/bbr)](https://cran.r-project.org/package=bbr)
[![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-3.0.html)
[![Last-changedate](https://img.shields.io/badge/last%20change-`r gsub('-', '--', Sys.Date())`-brightgreen.svg)](/commits/master)

The bbr package is designed to quickly fetch tidy data from www.basketball-reference.com.
This package is actively under development and the interface will change as new features are added.

## Installation

```{r, eval = FALSE}
devtools::install_github("mbjoseph/bbr")
```

## Example usage

The `get_season` function retrieves season summary data for one season.

```{r, echo = TRUE}
library(bbr)

ninetyone <- get_season(1991)
str(ninetyone)
```

The `get_players` function gets player data for individuals by last initial.

```{r, echo = TRUE}
a_data <- get_players("A")
str(a_data)
```

The `get_player_data` function returns data for each season that a player
played. As an argument, this function takes a slug for the player you're
interested in. This can be found using the `get_players()` function, and is
part of the URL to the data of a player, e.g., if the URL is
https://www.basketball-reference.com/players/a/abdelal01.html then the slug is
abdelal01.

```{r, echo = TRUE}
abdelnaby_d <- get_player_data('abdelal01')
str(abdelnaby_d)
```