nba_scraper: Scrape NBA statistics data from ESPN into CSV file

Description Usage Arguments Value Examples

View source: R/nba_scraper.R

Description

Scrape the tabular data from ESPN NBA website using RSelenium and returns a tibble of the data. Users can specify the seaason year and season type. User should also specify the port for Selenium driver. By default, the function will not write to csv until a string input for "csv_path" is given.

Usage

1
2
3
4
5
6
nba_scraper(
  season_year = 2018,
  season_type = "regular",
  port = 4445L,
  csv_path = NULL
)

Arguments

season_year

int from 2001 to 2019 (upper limit based on latest year)

season_type

string. Either "regular" or "postseason"

port

int with L suffix. Must not be negative.

csv_path

string for csv file. Defaults to NULL. If specified, must end with ".csv".

Value

A tibble of scraped ESPN NBA data

Examples

1
2
3
4
5
6
7
8
# Scrape regular season 2018/19 without saving to a csv file
nba_2018 <- nba_scraper(2018, season_type = "regular", port=4445L)


# Scrape playoffs season 2017/18 while saving to a local csv file.
nba_2017 <- nba_scraper(2017, season_type = "postseason",
                        port=4445L,
                        csv_path = "nba_2017_playoffs.csv")

kfoofw/test_githubactions documentation built on March 14, 2020, 12:05 a.m.