prospect_cube: Pull Prospect Rankings

Description Usage Arguments Examples

View source: R/prospect_cube.R

Description

Scrape data from http://www.thebaseballcube.com to look at the top 100 prospects list for each team or the top prospects by team. Can use this information to approximate the relative strength of each teams farm system.

Usage

1
prospect_cube(team, year, src = "BA", start_year = NULL, end_year = NULL)

Arguments

team

Specify the team abbreviation as character value. Use this value to pull the top prospects by team

year

Numeric year. Specifying the year will pull only the top 100 prospects. Default is to take the past full season if pulled in the offseason or the current season if pulled after opening day.

src

Character value specifying the source to use for the prospect rankings. Options are '"BA"' for Baseball America or '"PIPE"' for MLB Pipeline. Default is Baseball America

start_year

Numeric value that identifies the beginning year to pull a range of data for the team of interest. This is an optional parameter.

end_year

Numeric value that identifies the ending year to pull a range of data for the team of interest. This is an optional parameter.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#pulling top 100 prospectes from 2017
top_prospects <- prospect_cube(year = 2017, src = "PIPE")
table(top_prospects$current_lvl)

#pulling prospect rankings from Colorado Rockies from Baseball America
col_prospects <- prospect_cube(team = "COL", src = "BA")
library(dplyr)
top_prospects <- col_prospects %>%
                   group_by(Year)%>%
                   summarise(num_top_100 = sum(MLB!=""), avg_age = mean(as.numeric(Age)))
top_prospects <- top_prospects[order(top_prospects$num_top_100, decreasing = TRUE),]
top_prospects

williazo/rwindow.baseball documentation built on May 29, 2019, 11:47 a.m.