Package: baseballr 1.6.0.9001

Saiem Gilani

baseballr: Acquiring and Analyzing Baseball Data

Provides numerous utilities for acquiring and analyzing baseball data from online sources such as 'Baseball Reference' <https://www.baseball-reference.com/>, 'FanGraphs' <https://www.fangraphs.com/>, and the 'MLB Stats' API <https://www.mlb.com/>.

Authors:Bill Petti [aut], Saiem Gilani [aut, cre], Ben Baumer [ctb], Ben Dilday [ctb], Robert Frey [ctb], Camden Kay [ctb]

baseballr_1.6.0.9001.tar.gz
baseballr_1.6.0.9001.zip(r-4.5)baseballr_1.6.0.9001.zip(r-4.4)baseballr_1.6.0.9001.zip(r-4.3)
baseballr_1.6.0.9001.tgz(r-4.4-any)baseballr_1.6.0.9001.tgz(r-4.3-any)
baseballr_1.6.0.9001.tar.gz(r-4.5-noble)baseballr_1.6.0.9001.tar.gz(r-4.4-noble)
baseballr_1.6.0.9001.tgz(r-4.4-emscripten)baseballr_1.6.0.9001.tgz(r-4.3-emscripten)
baseballr.pdf |baseballr.html
baseballr/json (API)
NEWS

# Install 'baseballr' in R:
install.packages('baseballr', repos = c('https://billpetti.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/billpetti/baseballr/issues

Datasets:

On CRAN:

baseballpitchfxsabermetricsstatcast

9.37 score 369 stars 500 scripts 1.5k downloads 188 exports 54 dependencies

Last updated 8 days agofrom:ec1af2f5b2. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 15 2024
R-4.5-winOKNov 15 2024
R-4.5-linuxOKNov 15 2024
R-4.4-winOKNov 15 2024
R-4.4-macOKNov 15 2024
R-4.3-winOKNov 15 2024
R-4.3-macOKNov 15 2024

Exports:batter_game_logs_fgbref_daily_batterbref_daily_pitcherbref_standings_on_datebref_team_resultschadwick_find_libchadwick_is_installedchadwick_ld_library_pathchadwick_pathchadwick_player_luchadwick_set_ld_library_pathcode_barreldaily_batter_brefdaily_pitcher_brefedge_codeedge_frequencyfg_bat_leadersfg_batter_game_logsfg_batter_leadersfg_fielder_leadersfg_gutsfg_milb_batter_game_logsfg_milb_pitcher_game_logsfg_parkfg_park_handfg_pitch_leadersfg_pitcher_game_logsfg_pitcher_leadersfg_team_batterfg_team_fielderfg_team_pitcherfip_plusget_batting_ordersget_chadwick_luget_draft_mlbget_game_info_mlbget_game_info_sup_pettiget_game_pks_mlbget_ncaa_baseball_pbpget_ncaa_baseball_rosterget_ncaa_game_logsget_ncaa_lineupsget_ncaa_park_factorget_ncaa_schedule_infoget_pbp_mlbget_probables_mlbget_retrosheet_dataget_umpire_ids_pettiggspraychartlabel_statcast_imputed_datalinear_weights_savantload_game_info_supload_ncaa_baseball_pbpload_ncaa_baseball_scheduleload_ncaa_baseball_season_idsload_ncaa_baseball_teamsload_umpire_idsmilb_batter_game_logs_fgmilb_pitcher_game_logs_fgmlb_all_star_ballotsmlb_all_star_final_votemlb_all_star_write_insmlb_attendancemlb_awardsmlb_awards_recipientmlb_baseball_statsmlb_batting_ordersmlb_conferencesmlb_divisionsmlb_draftmlb_draft_latestmlb_draft_prospectsmlb_event_typesmlb_fielder_detail_typesmlb_game_changesmlb_game_contentmlb_game_context_metricsmlb_game_infomlb_game_linescoremlb_game_pacemlb_game_pksmlb_game_status_codesmlb_game_timecodesmlb_game_typesmlb_game_wpmlb_high_low_statsmlb_high_low_typesmlb_hit_trajectoriesmlb_homerun_derbymlb_homerun_derby_bracketmlb_homerun_derby_playersmlb_job_typesmlb_jobsmlb_jobs_datacastersmlb_jobs_official_scorersmlb_jobs_umpiresmlb_languagesmlb_leaguemlb_league_leader_typesmlb_logical_eventsmlb_metricsmlb_pbpmlb_pbp_diffmlb_peoplemlb_people_free_agentsmlb_pitch_codesmlb_pitch_typesmlb_player_game_statsmlb_player_game_stats_currentmlb_player_status_codesmlb_positionsmlb_probablesmlb_review_reasonsmlb_roster_typesmlb_rostersmlb_runner_detail_typesmlb_schedulemlb_schedule_event_typesmlb_schedule_games_tiedmlb_schedule_postseasonmlb_schedule_postseason_seriesmlb_seasonsmlb_seasons_allmlb_situation_codesmlb_skymlb_sportsmlb_sports_infomlb_sports_playersmlb_standingsmlb_standings_typesmlb_stat_groupsmlb_stat_typesmlb_statsmlb_stats_leadersmlb_team_affiliatesmlb_team_alumnimlb_team_coachesmlb_team_historymlb_team_infomlb_team_leadersmlb_team_personnelmlb_team_statsmlb_teamsmlb_teams_statsmlb_teams_stats_leadersmlb_venuesmlb_wind_direction_codesmost_recent_mlb_seasonmost_recent_ncaa_baseball_seasonncaa_baseball_pbpncaa_baseball_rosterncaa_game_logsncaa_lineupsncaa_park_factorncaa_pbpncaa_rosterncaa_schedule_infoncaa_school_id_luncaa_scrapencaa_team_player_statsncaa_teamspitcher_game_logs_fgplayerid_lookupplayername_lookupprocess_statcast_payloadretrosheet_datarun_expectancy_codeschool_id_luscrape_savant_leaderboardsscrape_statcast_savantscrape_statcast_savant_batterscrape_statcast_savant_batter_allscrape_statcast_savant_pitcherscrape_statcast_savant_pitcher_allscrape_statcast_savant.Datescrape_statcast_savant.defaultsptrc_league_payrollssptrc_team_active_payrollstandings_on_date_brefstatcast_leaderboardsstatcast_searchstatcast_search_battersstatcast_search_pitchersstatcast_search.defaultstatline_from_statcastteam_consistencyteam_results_brefwoba_plus

Dependencies:askpassclicolorspacecpp11curldata.tabledplyrfansifarvergenericsggplot2gluegtablehmshttrisobandjanitorjsonlitelabelinglatticelifecyclelubridatemagrittrMASSMatrixmgcvmimemunsellnlmeopensslpillarpkgconfigpurrrR6RColorBrewerRcppRcppParallelrlangrvestscalesselectrsnakecasestringistringrsystibbletidyrtidyselecttimechangeutf8vctrsviridisLitewithrxml2

Readme and manuals

Help Manual

Help pageTopics
*(legacy) Scrape Batter Game Logs from FanGraphs*batter_game_logs_fg
*Baseball Reference Functions Overview*bref
*Scrape Batter Performance Data Over a Custom Time Frame*bref_daily_batter
*Scrape Pitcher Performance Data Over a Custom Time Frame*bref_daily_pitcher
*Scrape MLB Standings on a Given Date*bref_standings_on_date
*Scrape Team Results*bref_team_results
*Chadwick Bureau Register Player Lookup*chadwick
Check Chadwick installationchadwick_find_lib chadwick_is_installed chadwick_ld_library_path chadwick_path chadwick_set_ld_library_path
*Download the Chadwick Bureau's public register of baseball players*chadwick_player_lu get_chadwick_lu
*Helper for determining whether a batted ball is a "barrel"*code_barrel
*Column structure of the MLB Draft data*column_structure_draft_mlb
*(legacy) Scrape Batter Performance Data Over a Custom Time Frame*daily_batter_bref
*(legacy) Scrape Pitcher Performance Data Over a Custom Time Frame*daily_pitcher_bref
*Edge Code*edge_code
*Edge Percentage Frequency*edge_frequency
*FanGraphs Functions Overview*fangraphs
*(legacy) Scrape Batter Leaderboards from FanGraphs*fg_bat_leaders
*Scrape Batter Game Logs from FanGraphs*fg_batter_game_logs
*Scrape Batter Leaderboards from FanGraphs*fg_batter_leaders
*Scrape Fielder Leaderboards from FanGraphs*fg_fielder_leaders
*Scrape FanGraphs.com Guts!*fg_guts
*Scrape MiLB game logs for batters from FanGraphs*fg_milb_batter_game_logs
*Scrape MiLB game logs for pitchers from FanGraphs*fg_milb_pitcher_game_logs
*Scrape Park Factors from FanGraphs*fg_park fg_park_hand
*(legacy) Scrape Pitcher Leaderboards from FanGraphs*fg_pitch_leaders
*Scrape Pitcher Game Logs from FanGraphs*fg_pitcher_game_logs
*Scrape Pitcher Leaderboards from FanGraphs*fg_pitcher_leaders
*Scrape Team Batter Leaderboards from FanGraphs*fg_team_batter
*Scrape Team Fielder Leaderboards from FanGraphs*fg_team_fielder
*Scrape Team Pitcher Leaderboards from FanGraphs*fg_team_pitcher
*Calculate FIP and related metrics for any set of data*fip_plus
*(legacy) Retrieve batting orders for a given MLB game*get_batting_orders
*(legacy) Retrieve draft pick information by year*get_draft_mlb
*(legacy) Retrieve additional game information for major and minor league games*get_game_info_mlb
*(legacy) Download a data frame of supplemental data about MLB games since 2008.*get_game_info_sup_petti
*(legacy) Get MLB Game Info by Date and Level*get_game_pks_mlb
*(legacy) Get Play-By-Play Data for NCAA Baseball Games*get_ncaa_baseball_pbp ncaa_baseball_pbp
*(legacy) Get NCAA Baseball Game Logs*get_ncaa_game_logs
*(legacy) Retrieve lineups for a given NCAA game via its 'game_info_url'*get_ncaa_lineups
*(legacy) Get Park Effects for NCAA Baseball Teams*get_ncaa_park_factor
*(legacy) Get Schedule and Results for NCAA Baseball Teams*get_ncaa_schedule_info
*(legacy) Acquire pitch-by-pitch data for Major and Minor League games*get_pbp_mlb
*(legacy) Retrieve probable starters for a given MLB game*get_probables_mlb
*(legacy) Get, Parse, and Format Retrosheet Event and Roster Files*get_retrosheet_data
*(legacy) Download a data frame of all umpires and their MLBAM IDs for games since 2008*get_umpire_ids_petti
*Generate spray charts with ggplot2*ggspraychart
*Label Statcast data as imputed*label_statcast_imputed_data
*Generate linear weight values for events using Baseball Savant data*linear_weights_savant
*Download a data frame of supplemental data about MLB games since 2008.*load_game_info_sup
*Load cleaned NCAA baseball play-by-play data from the baseballr data repo*load_ncaa_baseball_pbp
*Load cleaned NCAA baseball schedule from the baseballr data repo*load_ncaa_baseball_schedule
*Load cleaned NCAA men's college baseball season IDs from the baseballr data repo*load_ncaa_baseball_season_ids
*Load cleaned NCAA men's college baseball teams from the baseballr data repo*load_ncaa_baseball_teams
*Download a data frame of all umpires and their mlbamids for games since 2008*load_umpire_ids
*Metrics Functions Overview*metrics
*(legacy) Scrape MiLB game logs for batters from FanGraphs*milb_batter_game_logs_fg
*(legacy) Scrape MiLB game logs for pitchers from FanGraphs*milb_pitcher_game_logs_fg
*MLB Functions Overview*mlb
*Find MLB All-Star Ballots*mlb_all_star_ballots
*Find MLB All-Star Final Vote*mlb_all_star_final_vote
*Find MLB All-Star Write-ins*mlb_all_star_write_ins
*MLB Attendance*mlb_attendance
*MLB All-Star, Awards, Home Run Derby Functions*mlb_award
*MLB Awards*mlb_awards
*MLB Award Recipients*mlb_awards_recipient
*MLB Baseball Stats*mlb_baseball_stats
*Retrieve batting orders for a given MLB game*mlb_batting_orders
*View all PCL conferences*mlb_conferences
*MLB Divisions*mlb_divisions
*Retrieve draft pick information by year*mlb_draft
*Retrieve latest draft information by year*mlb_draft_latest
*Retrieve draft prospect information by year*mlb_draft_prospects
*MLB Event Types*mlb_event_types
*MLB Fielder Detail Types*mlb_fielder_detail_types
*Acquire time codes for Major and Minor League games*mlb_game_changes
*Retrieve additional game content for major and minor league games*mlb_game_content
*Acquire game context metrics for Major and Minor League games*mlb_game_context_metrics
*Retrieve additional game information for major and minor league games*mlb_game_info
*Retrieve game linescores for major and minor league games*mlb_game_linescore
*Retrieve game pace metrics for major and minor league*mlb_game_pace
*Get MLB Game Info by Date and Level*mlb_game_pks
*MLB Game Status Codes*mlb_game_status_codes
*Acquire time codes for Major and Minor League games*mlb_game_timecodes
*MLB Game Types*mlb_game_types
*Acquire win probability for Major and Minor League games*mlb_game_wp
*Acquire high/low stats for Major and Minor Leagues*mlb_high_low_stats
*MLB Stat High/Low Types*mlb_high_low_types
*MLB Hit Trajectories*mlb_hit_trajectories
*Retrieve Homerun Derby data*mlb_homerun_derby
*Retrieve Homerun Derby Bracket*mlb_homerun_derby_bracket
*Retrieve Homerun Derby Players*mlb_homerun_derby_players
*MLB Job Types*mlb_job_types
*MLB Jobs*mlb_jobs
*MLB Jobs Datacasters*mlb_jobs_datacasters
*MLB Jobs Official Scorers*mlb_jobs_official_scorers
*MLB Jobs Umpires*mlb_jobs_umpires
*MLB API Language Options*mlb_languages
*MLB Leagues*mlb_league
*MLB League Leader Types*mlb_league_leader_types
*MLB Logical Events*mlb_logical_events
*MLB Metrics*mlb_metrics
*Acquire pitch-by-pitch data for Major and Minor League games*mlb_pbp
*Acquire pitch-by-pitch data between two timecodes for Major and Minor League games*mlb_pbp_diff
*Find Biographical Information for MLB Players*mlb_people
*Find Information About MLB Free Agents*mlb_people_free_agents
*MLB Pitch Codes*mlb_pitch_codes
*MLB Pitch Types*mlb_pitch_types
*Find MLB Player Game Stats*mlb_player_game_stats
*Find MLB Player Game Stats - Current Game*mlb_player_game_stats_current
*MLB Player Status Codes*mlb_player_status_codes
*MLB Positions*mlb_positions
*Retrieve probable starters for a given MLB game*mlb_probables
*MLB Review Reasons*mlb_review_reasons
*MLB Roster Types*mlb_roster_types
*Find MLB Rosters by Roster Type*mlb_rosters
*MLB Runner Detail Types*mlb_runner_detail_types
*Find game_pk values for professional baseball games (major and minor leagues)*mlb_schedule
*MLB Schedule Event Types*mlb_schedule_event_types
*Find game_pk values for professional baseball games (major and minor leagues) that are tied*mlb_schedule_games_tied
*Find game_pk values for professional baseball postseason games (major and minor leagues)*mlb_schedule_postseason
*Find game_pk values for professional baseball postseason series games (major and minor leagues)*mlb_schedule_postseason_series
*Find MLB Seasons*mlb_seasons
*Find MLB Seasons all*mlb_seasons_all
*MLB Situation Codes*mlb_situation_codes
*MLB Sky (Weather) Codes*mlb_sky
*MLB Sport IDs*mlb_sports
*MLB Sport IDs Information*mlb_sports_info
*MLB Sport Players*mlb_sports_players
*MLB Standings*mlb_standings
*MLB Standings Types*mlb_standings_types
*MLB Stat Groups*mlb_stat_groups
*MLB Stat Types*mlb_stat_types
*MLB Stats*mlb_stats
*MLB Stats Leaders*mlb_stats_leaders
*MLB Team Affiliates*mlb_team_affiliates
*MLB Team Alumni*mlb_team_alumni
*MLB Team Coaches*mlb_team_coaches
*MLB Teams History*mlb_team_history
*MLB Team Info*mlb_team_info
*MLB Team Leaders*mlb_team_leaders
*MLB Team Personnel*mlb_team_personnel
*MLB Team Individual Stats*mlb_team_stats
*MLB Teams*mlb_teams
*MLB Teams Stats*mlb_teams_stats
*MLB Teams Stats Leaders*mlb_teams_stats_leaders
*Find MLB Venues*mlb_venues
*MLB Wind Direction Codes*mlb_wind_direction_codes
*Most Recent MLB Season*most_recent_mlb_season
*Most Recent NCAA Baseball Season*most_recent_ncaa_baseball_season
*NCAA Functions Overview*ncaa
*(legacy) Get NCAA Baseball Rosters*get_ncaa_baseball_roster ncaa_baseball_roster
*Get NCAA Baseball Game Logs*ncaa_game_logs
*Retrieve lineups for a given NCAA game via its 'game_info_url'*ncaa_lineups
*Get Park Effects for NCAA Baseball Teams*ncaa_park_factor
*Get Play-By-Play Data for NCAA Baseball Games*ncaa_pbp
*Get NCAA Baseball Rosters*ncaa_roster
*Get Schedule and Results for NCAA Baseball Teams*ncaa_schedule_info
*Lookup NCAA baseball school IDs (Division I, II, and III)*ncaa_school_id_lu
*(legacy) Scrape NCAA baseball Team Player Stats (Division I, II, and III)*ncaa_scrape
*Scrape NCAA baseball Team Player Stats (Division I, II, and III)*ncaa_team_player_stats
*Scrape NCAA baseball Teams (Division I, II, and III)*ncaa_teams
*(legacy) Scrape Pitcher Game Logs from FanGraphs*pitcher_game_logs_fg
*Look up Baseball Player IDs by Player Name*playerid_lookup
*Look up Baseball Player Name by ID*playername_lookup
*Process Baseball Savant CSV payload*process_statcast_payload
*Get, Parse, and Format Retrosheet Event and Roster Files*retrosheet_data
*Generate run expectancy and related measures from Baseball Savant data*run_expectancy_code
*(legacy) Lookup NCAA baseball school IDs (Division I, II, and III)*school_id_lu
*(legacy) Query Baseball Savant Leaderboards*scrape_savant_leaderboards
*(legacy) Query Statcast by Date Range and Players*scrape_statcast_savant scrape_statcast_savant.Date scrape_statcast_savant.default scrape_statcast_savant_batter scrape_statcast_savant_batter_all scrape_statcast_savant_pitcher scrape_statcast_savant_pitcher_all
*Scrape League Payroll Breakdowns from Spotrac*sptrc_league_payrolls
*Scrape Team Active Payroll Breakdown from Spotrac*sptrc_team_active_payroll
*(legacy) Scrape MLB Standings on a Given Date*standings_on_date_bref
*Statcast Functions Overview*statcast
*Statcast Label Imputation*statcast_impute
*Query Baseball Savant Leaderboards*statcast_leaderboards
*Query Statcast by Date Range and Players*statcast_search statcast_search.default statcast_search_batters statcast_search_pitchers
*Create stat lines from Statcast data*statline_from_statcast
*Column structure of MLB Stats Live Game API data frame*stats_api_live_empty_df
*Calculate Team-level Consistency*team_consistency
*(legacy) Scrape Team Results*team_results_bref
*A Team Lookup Table*teams_lu_table
*Calculate wOBA and related metrics for any set of data*woba_plus