Learn R Programming

nflscrapR (version 1.8.3)

season_player_game: Boxscore for Each Game in the Season - One line per player per game

Description

This function outputs a single dataframe containing all rushing, passing, receiving, fumble, and defensive statistics for each player in each game. Each player is assigned one line associated wih their statisitcs per each game they record a measured statistic

Usage

season_player_game(Season, Weeks = 16)

Arguments

Season

(numeric) A 4-digit year associated with a given season

Week

(numeric) A number corresponding to the number of weeks of data you want to be scraped and included in the output. If you input 3, the first three weeks of player statistics will be scraped from the associated season.

Value

A single line for each player in each game they played in. The output is the same as the player_game function but is run for every game in the specified season

Examples

Run this code
# NOT RUN {
# Player-Game function over the entire season in 2010
playerstats.2010 <- season_player_game(2010)
head(playerstats.2010)

# Plot a graph of different play types
library(ggplot2)
ggplot(playerstats.2010, aes(x = PlayType)) + geom_bar()
# }

Run the code above in your browser using DataLab