View source: R/write_pgtable.R
write_pgtable | R Documentation |
data.frames
to PostgresThis function takes a data.frame
or a list
of data.frames
and writes them to a
specified schema
using your database connection conn
.
Field types should be specified, it not
the default values from dbDataType()
will be used.
write_pgtable(conn, input, field.types = NULL, schema = "public", tbl_name = NULL, tbl.comments = NULL, field.comments = NULL, clean_vars = FALSE, verbose = TRUE, ...)
conn |
a object inheriting from |
input |
a |
field.types |
a named |
schema |
an optional argument to specify the desired database schema location, default is |
tbl_name |
a required option if |
tbl.comments |
an optional argument to include a comment for the table being written, if a |
field.comments |
an optional argument to include comments for each field type within the table being written , if a |
clean_vars |
an optional |
verbose |
a |
... |
other arguments passed to The |
This function is essentially a wrapper for dbWriteTable()
. See details in RPostgres
documentation under postgres-tables
.
If input
is a list
of data frames, dimensions of field.types
, tbl.comments
, and
field.comments
must match input
.
write_pgtable()
returns TRUE
invisibly.
## Not run: nchar_df <- get_nchar(iris) my_fields <- set_pgfields(nchar_df, default = FALSE, conn = DBI::dbConnect(RSQL::SQLite(), ":memory:")) write_pgtable(input = iris, field.types = my_fields, conn = DBI::dbConnect(RSQL::SQLite(), ":memory:"), tbl_name = "iris") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.