update_mbb_db: *Update or create a hoopR play-by-play database*

Description Usage Arguments Details Value

View source: R/mbb_pbp.R

Description

update_mbb_db() updates or creates a database with hoopR play by play data of all completed and available games since 2006.

Usage

1
2
3
4
5
6
7
update_mbb_db(
  dbdir = ".",
  dbname = "hoopR_db",
  tblname = "hoopR_mbb_pbp",
  force_rebuild = FALSE,
  db_connection = NULL
)

Arguments

dbdir

Directory in which the database is or shall be located

dbname

File name of an existing or desired SQLite database within dbdir

tblname

The name of the play by play data table within the database

force_rebuild

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)

db_connection

A DBIConnection object, as returned by DBI::dbConnect() (please see details for further information)

Details

This function creates and updates a data table with the name tblname within a SQLite database (other drivers via db_connection) located in dbdir and named dbname. The data table combines all play by play data for every available game back to the 2006 season and adds the most recent completed games as soon as they are available for hoopR.

The argument force_rebuild is of hybrid type. It can rebuild the play by play data table either for the whole hoopR era (with force_rebuild = TRUE) or just for specified seasons (e.g. force_rebuild = c(2019, 2020)). Please note the following behavior:

The parameter db_connection is intended for advanced users who want to use other DBI drivers, such as MariaDB, Postgres or odbc. Please note that the arguments dbdir and dbname are dropped in case a db_connection is provided but the argument tblname will still be used to write the data table into the database.

Value

Returns a logical value (TRUE/FALSE)


hoopR documentation built on Nov. 10, 2021, 5:07 p.m.