| db.write.table {RPgSQL} | R Documentation |
db.write.table writes data stored in an R data frame into a
PostgreSQL table.
db.write.table(data, name=deparse(substitute(data)), no.clobber=T, write.row.names=F)
data |
A data frame or object that inherits from data.frame |
name |
A name for the PostgreSQL table |
no.clobber |
A boolean indicating whether to overwrite existing tables |
write.row.names |
A boolean indicating whether to write row names into the database table |
The current implementation is not very fast.
Timothy H. Keitt
if (db.connection.open()) {
data(airquality)
rpgsql.test.data <- airquality[1:10,]
rm(airquality)
db.write.table(rpgsql.test.data, no.clobber=F)
if (db.table.exists('rpgsql_test_data')) {
db.read.table('rpgsql.test.data')
db.rm('rpgsql.test.data', ask=F)
}
}