ps_write_table: Write Table

Description Usage Arguments Details

View source: R/write.R

Description

Appends a data frame to an existing table in an SQLite database without row names. More importantly it saves the time zone for POSIXct columns in the metadata table and converts the column to a character vector of format 'YYYY-mm-dd HH:MM:SS'. It also saves the projection and converts the geometry column to a character vector for sfc columns. And saves any column comments to the DataDescription entry in the metadata table.

Usage

1
2
3
4
5
6
7
8
9
ps_write_table(
  x,
  table_name,
  conn = getOption("ps.conn"),
  delete = FALSE,
  overwrite_units = FALSE,
  overwrite_descriptions = FALSE,
  rename = identity
)

Arguments

x

The data frame.

table_name

A string of the name of the table.

conn

An SQLiteConnection object.

delete

A flag indicating whether to delete the existing data before appending the data.

overwrite_units

A flag indicating whether to overwrite existing units.

overwrite_descriptions

A flag indicating whether to overwrite existing descriptions.

rename

A function to rename column names in x.

Details

ps_read_table looks up the time zone and projection and converts the column back to a POSIXct vector with the original timezone or sfc column with projection.

The function is also agnostic as to the order of the columns.


poissonconsulting/poissqlite documentation built on Sept. 17, 2021, 12:34 a.m.