db.write.table {RPgSQL}R Documentation

Write an R data frame into a PostgreSQL table

Description

db.write.table writes data stored in an R data frame into a PostgreSQL table.

Usage

db.write.table(data, name=deparse(substitute(data)), no.clobber=T, write.row.names=F)

Arguments

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

Note

The current implementation is not very fast.

Author(s)

Timothy H. Keitt

See Also

db.read.table

Examples

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)
  }
}