Learn R Programming

rpg (version 1.6)

register_return_formatter: Convert R objects to strings

Description

Prepare R objects for sending to postgresql

Usage

register_return_formatter(pgoid, f)

format_for_send(obj)

Arguments

pgoid

the PostgreSQL type Oid

f

a function

obj

any object

Details

The function f must accept a vector of character values and return a vector of values formated appropriately.

R objects that will be written to postgresql must be converted to characters as all data is transferred to the server as text. The S3 method foramt_for_send accomplishes this. It accepts any object and returns a character representation.

You can define new conversions by supplying your own S3 override of format_for_send.