Skip to content

Block 2, Task 4: A Little SQL #8

@mbannert

Description

@mbannert

Set up and connect to an sqlite database using R.

Here's some basic syntax

library(RSQLite)
# row names are not stored in the DB
# that's why we add an extra column here
mtcars$name <- row.names(mtcars)

db_path = "data/h4sci.sqlite3"
con <- dbConnect(RSQLite::SQLite(), db_path)
dbWriteTable(con, dbQuoteIdentifier(con,"mtcars"), mtcars)
# Only do this when you're done playing
dbDisconnect(con)

Add your favorite dataset from the fivethirtyeight package to that database.

Evaluate the following statement critically:

"If your data fits in memory there is no advantage to putting it in a database: it will only be slower and more frustrating."
-- taken from the {dbplyr} documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions