Add data with a data frame to your PostgreSQL database. The data frame name must match the table name in your database, if not use the tbl_name argument to pass the table name.

psql_add_data(
  tbl,
  schema = "public",
  tbl_name = NULL,
  config_path = getOption("psql.config_path", NULL),
  config_value = getOption("psql.config_value", "default")
)

Arguments

tbl

The data frame to add to the database.

schema

A string of the schema name. Default value is "public".

tbl_name

A string indicating the name of the table. Default is to use the name of the tbl argument.

config_path

A string of a file path to the yaml configuration file. The default value grabs the file path from the psql.config_path option and uses NULL if no value supplied.

config_value

A string of the name of value. The default value grabs the value from the psql.config_value option and uses "default" if no value is supplied.

Value

A scalar numeric.

Details

The function open and closes its own database connection. You do not need to close the database connection afterwards.

This function uses DBI::dbAppendTable() to add data to the database.

Examples

if (FALSE) { # \dontrun{
psql_add_data(outing, "creel")
psql_add_data(outing_new, "creel", "outing")
} # }