createF1db: Create an F1 database

View source: R/db.R

createF1dbR Documentation

Create an F1 database

Description

Creates a local 'DuckDB' or 'SQLite' database using the latest 'Ergast' data and establish a connection.

Usage

createF1db(csv_dir = NULL, rm_csv = FALSE, type = "duckdb")

Arguments

csv_dir

either NULL or the name of a directory containing csv files from Ergast. If NULL, the files will be downloaded and placed in a directory within the working directory named "/f1db_csv"

rm_csv

logical indicating whether the csv directory should be deleted after initializing the database

type

"duckdb" or "sqlite"

Details

createF1db() creates a local 'DuckDB' or 'SQLite' database using csv files downloaded from Ergast. The database will be located in a file 'f1_db.duckdb' 'f1_db.sqlite' within the working directory.

Databases created with this function can be interacted with using functions from the 'DBI' Package. You can also use the convenience function F1dbConnect to reconnect to a database created by createF1db

Value

an object of class duckdb_connection or SQLiteConnection

Examples


library(DBI)
con <- createF1db()
dbListTables(con)
dbDisconnect(con)


arkraieski/formula1data documentation built on March 24, 2024, 4:26 p.m.