Inserts into a table the values in a vector or data.frame. Subsets the values by column name.

INSERT_INTO_VALUES(tbl, vals, cols = NULL)

Arguments

tbl

Table name to insert into

vals

Values for insertion, can be a vector or a data.frame

cols

Columns to include

Examples

INSERT_INTO_VALUES('table', 1:3)
#> [1] "INSERT INTO table VALUES (1, 2, 3)"
INSERT_INTO_VALUES('table', c('a' = 1, 'b' = 2, 'c' = 3))
#> [1] "INSERT INTO table (a, b, c) VALUES (1, 2, 3)"
INSERT_INTO_VALUES('iris', iris[c(1, 51, 101), ], c("Sepal.Length", "Petal.Length", "Species"))
#> [1] "INSERT INTO iris (`Sepal.Length`, `Petal.Length`, Species) VALUES (5.1, 1.4, \"setosa\"), (7, 4.7, \"versicolor\"), (6.3, 6, \"virginica\")"