Skip to contents

This function allows the user to obtain batting, pitching, or fielding statistics for any school affiliated with the NCAA at the division I, II, or III levels. The function acquires data from the NCAA's website (stats.ncaa.org) and returns a tibble.

Usage

ncaa_team_player_stats(
  team_id,
  year = most_recent_ncaa_baseball_season(),
  type = "batting",
  ...
)

Arguments

team_id

The numerical ID that the NCAA website uses to identify a team

year

The season for which data should be returned, in the form of "YYYY". Years currently available: 2013-2017.

type

A string indicating whether to return "batting", "pitching", or "fielding" statistics

...

Additional arguments passed to an underlying function like httr.

Value

A data frame with the following variables. The exact stat columns vary by type (batting / pitching / fielding); the table below shows the batting (type = "batting") columns.

col_nametypesdescription
yearintegerSeason (4-digit year).
team_namecharacterTeam name.
team_idnumericTeam NCAA id.
conference_idintegerConference identifier.
conferencecharacterConference name.
divisionnumericNCAA division (1, 2, 3).
player_idintegerstats.ncaa.org player identifier.
player_urlcharacterFull stats.ncaa.org url for the player page.
player_namecharacterPlayer name.
YrcharacterAcademic class/year (Fr, So, Jr, Sr).
PoscharacterPrimary fielding position.
JerseycharacterJersey number (the site's "#" column).
GPnumericGames played.
GSnumericGames started.
BAnumericBatting average.
OBPctnumericOn-base percentage.
SlgPctnumericSlugging percentage.
RnumericRuns scored.
ABnumericAt-bats.
HnumericHits.
2BnumericDoubles.
3BnumericTriples.
TBnumericTotal bases.
HRnumericHome runs.
RBInumericRuns batted in.
BBnumericWalks (bases on balls).
HBPnumericHit by pitch.
SFnumericSacrifice flies.
SHnumericSacrifice hits (bunts).
KnumericStrikeouts.
DPnumericGrounded into double plays (site's "OPP DP").
CSnumericCaught stealing.
PickednumericTimes picked off.
SBnumericStolen bases.
RBI2outnumericRuns batted in with two outs.

Details

Live usage (reads stats.ncaa.org, which is behind Akamai bot protection and needs the optional chromote + Google Chrome browser fallback, so it is shown here rather than as a runnable example):

ncaa_team_player_stats(team_id = 234, year = 2023, type = "batting")