Insert: Insert

Description Usage Arguments Value See Also Examples

View source: R/Insert.R

Description

Convenience function to write a data.frame or matrix into a database table. The first column id will be added and incremented automatically if add_id is enabled.

Usage

1
Insert(data, table, db, add_id = FALSE, enforce_foreign_keys = TRUE)

Arguments

data

data.frame of data to be written into db table

table

chr of table name

db

chr full file name with path of database

add_id

bool (FALSE) whether 1st column named id with values NULL should be added (will be autoincremented in table accounts)

enforce_foreign_keys

bool (TRUE) whether to enforce rules on foreign keys

Value

TRUE if successful

See Also

Other SQLite handler functions: InsertBLOB, Intersect, SelectBLOB, Select, UpdateBLOB, Update

Examples

1
2
3
4
5
6
7
8
9
db <- "db/test.db"
Create_testDB(db)
df <- data.frame(
  owner = "B. Clinton", 
  iban = "IR98000020018267384", 
  bic = "IR875TW78", 
  type = "donations account"
)
Insert(df, "accounts", "db/test.db", add_id = TRUE)

mRcSchwering/abacus documentation built on May 21, 2019, 9:18 a.m.