update_db updates or creates a database with
play by play data of all completed games since 1999.
update_db( dbdir = getOption("nflfastR.dbdirectory", default = "."), dbname = "pbp_db", tblname = "nflfastR_pbp", force_rebuild = FALSE, db_connection = NULL )
Directory in which the database is or shall be located. Can also
be set globally with
File name of an existing or desired SQLite database within
The name of the play by play data table within the database
Hybrid parameter (logical or numeric) to rebuild parts of or the complete play by play data table within the database (please see details for further information)
This function creates and updates a data table with the name
within a SQLite database (other drivers via
db_connection) located in
dbdir and named
The data table combines all play by play data for every available game back
to the 1999 season and adds the most recent completed games as soon as they
are available for
force_rebuild is of hybrid type. It can rebuild the play
by play data table either for the whole nflfastR era (with
force_rebuild = TRUE)
or just for specified seasons (e.g.
force_rebuild = c(2019, 2020)).
Please note the following behavior:
force_rebuild = TRUE: The data table with the name
will be removed completely and rebuilt from scratch. This is helpful when
new columns are added during the Off-Season.
force_rebuild = c(2019, 2020): The data table with the name
will be preserved and only rows from the 2019 and 2020 seasons will be
deleted and re-added. This is intended to be used for ongoing seasons because
the NFL fixes bugs in the underlying data during the week and we recommend
rebuilding the current season every Thursday during the season.
db_connection is intended for advanced users who want
to use other DBI drivers, such as MariaDB, Postgres or odbc. Please note that
dbname are dropped in case a
is provided but the argument
tblname will still be used to write the
data table into the database.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.