dbWriteTable,SQLiteConnection,character,data.frame-method {RSQLite} | R Documentation |
Write a local data frame or file to the database.
## S4 method for signature 'SQLiteConnection,character,data.frame' dbWriteTable(conn, name, value, row.names = NA, overwrite = FALSE, append = FALSE, field.types = NULL) ## S4 method for signature 'SQLiteConnection,character,character' dbWriteTable(conn, name, value, field.types = NULL, overwrite = FALSE, append = FALSE, header = TRUE, colClasses = NA, row.names = FALSE, nrows = 50, sep = ",", eol = "\n", skip = 0)
conn |
a |
name |
a character string specifying a table name. SQLite table names
are not case sensitive, e.g., table names |
value |
a data.frame (or coercible to data.frame) object or a
file name (character). In the first case, the data.frame is
written to a temporary file and then imported to SQLite; when |
row.names |
A logical specifying whether the |
overwrite |
a logical specifying whether to overwrite an existing table
or not. Its default is |
append |
a logical specifying whether to append to an existing table
in the DBMS. Its default is |
field.types |
character vector of named SQL field types where
the names are the names of new table's columns. If missing, types inferred
with |
header |
is a logical indicating whether the first data line (but see
|
colClasses |
Character vector of R type names, used to override defaults when imputing classes from on-disk file. |
nrows |
Number of rows to read to determine types. |
sep |
The field separator, defaults to |
eol |
The end-of-line delimiter, defaults to |
skip |
number of lines to skip before reading the data. Defaults to 0. |
con <- dbConnect(SQLite()) dbWriteTable(con, "mtcars", mtcars) dbReadTable(con, "mtcars") # A zero row data frame just creates a table definition. dbWriteTable(con, "mtcars2", mtcars[0, ]) dbReadTable(con, "mtcars2") dbDisconnect(con)