load_db: load_db

Description Usage Arguments Value

View source: R/load_db.R

Description

load_db

Usage

1
load_db(src_dir = "data", DB = "csv", week = 1)

Arguments

src_dir

specify the working directory of the database or csvs with players, play index, games and tracking data

DB

csv or sql , if sql is needed run create_db first

week

number to load when csv or NULL to fetch all

Will load all necessary dataframes to get information neccesary. When ran with csv, will load everything in memory, so only one week is loaded on default (1), this means default behaviour will look for week1.csv . If ran with parameter week=NULL, all files with prefix "week" available will be loaded. If the SQLite database is built (recommended), all connections are loaded using lazy loading, and will be much less hard on the RAM.

If experimenting with data not from databowl, here are the minimum requirements in each, for it to work without modifications. Other sports could work, but you would have to look for the ball identifiers, and player positions and modify accordingly Plays Index: gameId, playid Players: nflId, position Games: gameId, homeTeamAbbr, visitorTeamAbbr, week Tracking Data: time, x, y, a, dis, o, dir, event, nflId, displayName, jerseyNumber, frameId, team, gameId, playId, playDirection

plays_index %>% filter(.data$gameId%in% gameid & playId%in% playid)

Value

all connections loaded as lazy dataframes when run with DB, all databases loaded from csv.


ecastillomon/nflgisR documentation built on Jan. 25, 2021, 12:35 a.m.