Read from database {RPgSQL} | R Documentation |
db.read.table
reads a database table into a data
frame.
db.fetch.result
reads the contents of the query buffer
into a data frame.
db.read.column
returns a vector containing
values from a given column in the result buffer.
db.read.table(name, row.names, col.names, as.is=F) db.fetch.result(row.names, col.names, as.is=F) db.read.column(column=1, as.is=F)
name |
The name of a PostgreSQL table or a proxy object |
row.names |
A list of row names to apply to the data frame |
col.names |
A list of column names for the resulting data frame |
as.is |
A boolean or vector of booleans or column indices specifying which character type columns should not be converted to factors |
column |
The column number to read from the result buffer |
db.read.table
simply queries the entire table and then calls
db.fetch.result
.
db.read.column
does all the work; it
is useful when you want the results to be a vector and not a data
frame.
db.read.table
returns a data frame containing the data table.
db.fetch.result
returns data frame containing the query
results.
db.read.column
returns a vector containing a single
column of query output.
Timothy H. Keitt
if (db.connection.open()) { db.read.table('pg_user') db.execute('select usename, usesysid from pg_user', clear=F) db.fetch.result() db.read.column(column=2) db.clear.result() }