knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
library(maxprepsr)

UPDATE

Alas, this package violates CBS Sports Interactive Terms of Use:

Without limiting any other provision in these Terms, you agree not to do the following, or assist others to do the following:

Engage in unauthorized spidering, “scraping,” data mining or harvesting of Content, or use any other unauthorized automated means to gather data from or about the Services;

Thus, development on his package will cease immediately.


Introduction

Are you a high school athlete who loves to gaze at their own stats? Or are you a nerdy peer who likes to throw shade via snarky charts? Good news: maxprepsr is for both of you. With minimal input, you can scrape most of MaxPreps' tabular data into R. Perfect for the nerd-athlete.

What is MaxPreps?

I'll let them explain:

MaxPreps is America's Source for High School Sports. We are proud to be involved with America's hometown heroes – the young men and women working hard to improve their skills, place team above self, and serve as inspirations to their local communities. MaxPreps aspires to cover every team, every game and every player. We do this in partnership with nearly 100,000 varsity coaches throughout the United States.

Installation

maxprepsr is not on CRAN, but can be installed via:

devtools::install_github("daranzolin/maxprepsr")
library(maxprepsr)

Usage

There are three functions at present:

Exhibit A: Who had the most turnovers for the PUC Prep falcons during the 2004-2005 season?

suppressPackageStartupMessages(library(dplyr))
prep <- maxpreps_team_stats("pacific union college prep", "falcons", "angwin", "ca", "basketball", "04-05")
prep %>% 
  select(name, to) %>% 
  arrange(desc(as.numeric(to))) %>% 
  slice(1)

Yea, I turned the ball over a lot.

Exhibit B: Of the top 50 scoring point guards in California right now, how many are juniors?

ca_pgs <- maxpreps_indv_leaders(sport = "basketball", category = "scoring", state = "ca", position = "pg")
ca_pgs %>% 
  count(year)

Future Work



daranzolin/maxprepsr documentation built on May 14, 2019, 6:07 p.m.