dbReadTable-methods {RSQLite} | R Documentation |
These functions mimic their R/S-Plus counterpart
get
,
assign
,
exists
,
remove
, and
objects
,
except that they generate code that gets remotely executed
in a database engine.
A data.frame in the case of dbReadTable
; otherwise a logical
indicating whether the operation was successful.
SQLiteConnection
database connection object.
value
is a character, it is interpreted as a
file name and its contents imported to SQLite.
dbReadTable
, this argument can be a string or
an index specifying the column in the DBMS table to be used as
row.names
in the output data.frame (a NULL
, ""
, or 0
specifies that no column should be used as row.names
in the output).
In the case of dbWriteTable
, this argument should be a logical
specifying whether the row.names
should be output to the
output DBMS table; if TRUE
, an extra field whose name will be
whatever the R/S-Plus identifier "row.names"
maps to the DBMS
(see make.db.names
).
FALSE
. (See the BUGS section below).
FALSE
.
dbWriteTable
is used to import data from a file,
you may specify
a field separator sep=
(defaults to ','
),
end-of-line delimiter eol
(defaults to '\n'
),
and a named list of field types (field types are inferred using
dbDataType
).
These RSQLite methods do not use transactions, thus it is dangerous
to specify overwrite=TRUE
in dbWriteTable
(the
table is first removed and in case the data exporting fails
the original table is lost forever).
Note that the data.frame returned by dbReadTable
only has
primitive data, e.g., it does not coerce character data to factors.
SQLite table names are not case sensitive, e.g., table
names ABC
and abc
are considered equal.
See the Database Interface definition document
DBI.pdf
in the base directory of this package
or http://stat.bell-labs.com/RS-DBI.
sqliteImportFile
,
SQLite
,
dbDriver
,
dbConnect
,
dbSendQuery
,
dbGetQuery
,
fetch
,
dbCommit
,
dbGetInfo
,
dbListTables
,
dbReadTable
.
## Not run: conn <- dbConnect("SQLite", dbname = "sqlite.db") if(dbExistsTable(con, "fuel_frame")){ dbRemoveTable(conn, "fuel_frame") dbWriteTable(conn, "fuel_frame", fuel.frame) } if(dbExistsTable(conn, "RESULTS")){ dbWriteTable(conn, "RESULTS", results2000, append = T) else dbWriteTable(conn, "RESULTS", results2000) } ## End(Not run)