clean_and_rotate: Standardize direction and add play information

Description Usage Arguments Value

View source: R/cleaning_functions.R

Description

Standardize direction and add play information.

Usage

1

Arguments

df

A dataframe of player tracking data obtained from a Big Data Bowl or NGS highlights

Value

The original data with the columns below appended. Note that all returned columns will have cleaned names, including the original columns in df (e.g. play_id rather than playId), to end the tyranny of weird Big Data Bowl column names.

team_name

Values of home team (eg "SEA"), away team (eg "GB"), or "football"

defense

Whether player is on defense (football has 0 here)

play

Unique play identifier in format "gameid_playid" with gameid old GSIS format. Ex: "2018091000_1101".

nflfastr_game_id

Game ID in nflfastR format. Ex: "2018_01_ATL_PHI"

week

Week of season

posteam

Possession team

home_team

Home team (e.g. "PHI")

away_team

Away team (e.g. "ATL")

down

Down

ydstogo

Yards to go

yardline_100

Distance from opponent end zone

qtr

Quarter

epa

Expected Points Added gained on play from nflfastR

yards_gained

Yards gained on play

air_yards

Air yards (when applicable)

desc

Play description

pass

Was it a dropback? From nflfastR

rush

Was it a designed rush attempt? From nflfastR

play_type_nfl

Play type from NFL data. E.g. "PASS", "PENALTY", "RUSH", "SACK", "PUNT", etc.

team_color

Primary team color. Useful for play animations

team_color2

Secondary team color. Useful for play animations

team_logo_espn

URL of team logo

los_x

x location of line of scrimmage (e.g. 20 means own 10 yard line)

dist_from_los

Distance of player from line of scirmmage in x direction

o_x

Orientation of player in x direction

o_y

Orientation of player in y direction

dir_x

Direction of player in x direction

dir_y

Direction of player in y direction

s_x

Speed of player in x direction

s_y

Speed of player in y direction

a_x

Acceleration of player in x direction

a_y

Acceleration of player in y direction


guga31bb/ngscleanR documentation built on Dec. 20, 2021, 1:47 p.m.