Scrape NCAA baseball Team Player Stats (Division I, II, and III)
Source:R/ncaa_team_player_stats.R
ncaa_team_player_stats.Rd
This function allows the user to obtain batting or pitching 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" or "pitching" statistics
- ...
Additional arguments passed to an underlying function like httr.
Value
A data frame with the following variables
col_name | types |
year | integer |
team_name | character |
team_id | numeric |
conference_id | integer |
conference | character |
division | numeric |
player_id | integer |
player_url | character |
player_name | character |
Yr | character |
Pos | character |
Jersey | character |
GP | numeric |
GS | numeric |
BA | numeric |
OBPct | numeric |
SlgPct | numeric |
R | numeric |
AB | numeric |
H | numeric |
2B | numeric |
3B | numeric |
TB | numeric |
HR | numeric |
RBI | numeric |
BB | numeric |
HBP | numeric |
SF | numeric |
SH | numeric |
K | numeric |
DP | numeric |
CS | numeric |
Picked | numeric |
SB | numeric |
RBI2out | numeric |
Examples
# \donttest{
try(ncaa_team_player_stats(team_id = 234, year = 2023, type = "batting"))
#> ── NCAA Baseball Team Batting Stats data from stats.ncaa.org ───────────
#> ℹ Data updated: 2024-04-13 21:57:21 UTC
#> # A tibble: 38 × 35
#> year team_name team_id conference_id conference division player_id
#> <int> <chr> <dbl> <int> <chr> <dbl> <int>
#> 1 2023 Florida St. 234 821 ACC 1 2649339
#> 2 2023 Florida St. 234 821 ACC 1 2649334
#> 3 2023 Florida St. 234 821 ACC 1 2468075
#> 4 2023 Florida St. 234 821 ACC 1 2112619
#> 5 2023 Florida St. 234 821 ACC 1 2797459
#> 6 2023 Florida St. 234 821 ACC 1 2478605
#> 7 2023 Florida St. 234 821 ACC 1 2649307
#> 8 2023 Florida St. 234 821 ACC 1 2797428
#> 9 2023 Florida St. 234 821 ACC 1 2797460
#> 10 2023 Florida St. 234 821 ACC 1 2797482
#> # ℹ 28 more rows
#> # ℹ 28 more variables: player_url <chr>, player_name <chr>, Yr <chr>,
#> # Pos <chr>, Jersey <chr>, GP <dbl>, GS <dbl>, BA <dbl>, OBPct <dbl>,
#> # SlgPct <dbl>, R <dbl>, AB <dbl>, H <dbl>, `2B` <dbl>, `3B` <dbl>,
#> # TB <dbl>, HR <dbl>, RBI <dbl>, BB <dbl>, HBP <dbl>, SF <dbl>,
#> # SH <dbl>, K <dbl>, DP <dbl>, CS <dbl>, Picked <dbl>, SB <dbl>,
#> # RBI2out <dbl>
# }