| set_pgfields | R Documentation |
This function applies a Postgres field type based on either 1. The default output from DBI::dbDataType()
or 2. A preset condition that maps R classes to a specific Postgres field types.
set_pgfields(input, nchar_df, default = FALSE, conn = NULL)
input |
a |
nchar_df |
the output from |
default |
a |
conn |
a object inheriting from |
Factor to character varying (n) integer to smallint numeric to real character to character varying (n)
It is suggested to run get_nchar() prior to using set_pgfields() as get_nchar() is
a computationally expensive task.
returns a named character vector or list of named character vectors that will be used
to specify Postgres table field types when writing to the database.
## Not run:
data("iris")
nchar_df <- get_nchar(iris)
set_pgfields(nchar_df, conn = local_con_test)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.