library(dplyr)
my_db <- src_sqlite("DB.sqlite3")
data(pitches, package="pitchRx")
# Creates the 'pitches' table in the database
export(connect=my_db$con, value=pitches, name="pitches")
# Appends to the 'pitches' tables, but with the first column missing
export(connect=my_db$con, value=pitches[,-1], name="pitches")
tail(data.frame(collect(tbl(my_db, "pitches")))) #verify it appends correctly
# This data frame has a column that doesn't exist in the pitches table --
# so a new table is created.
export(connect=my_db$con, value=cbind(pitches, test="works"), name="pitches")Run the code above in your browser using DataLab