Utility functions {Rdbi}R Documentation

Utility functions

Description

list.to.csv converts a list of values to a comma seperated string.

list.to.key.pair.string takes a list and reformats it as a string with arbitrary seperators between keys and values and between key-value pairs.

printListPairs is a simple utility function that prints list key-value pairs nicely formated.

single.quote pastes its arguments into a single quoted string.

double.quote pastes its arguments into a double quoted string.

strip.line.feeds removes line feeds from a string.

expand.asis takes an "asis" argument as used in read.table and returns a vector of bools indicating whether columns should be converted to factors.

Usage

list.to.csv(...)
list.to.key.pair.string(key.list, key.sep = "=", pair.sep = " ")
printListPairs(list)
single.quote(...)
double.quote(...)
strip.line.feeds(x)
expand.asis(as.is, len = length(as.is))

Arguments

list A list of values.
key.sep Seperator between keys and values.
pair.sep Seperator between key-value pairs.
string A text string.
as.is A column name or number, or a vector of column numbers, or a vector of booleans indicating which columns to leave in character mode as opposed to converting to factors.
len The length of the output "asis" vector.

Author(s)

Timothy H. Keitt

References

http://rdbi.sourceforge.net/

Examples

list.to.csv(list(a = 'a', b = 'b', c = 'c'))
printListPairs(list(a = 'a', b = 'b', c = 'c'))
list.to.key.pair.string(list(a = 'a', b = 'b', c = 'c'),
 key.sep = " -> ", pair.sep = " | ")
single.quote("test")
double.quote("test")
expand.asis(5, 10)
strip.line.feeds("test\n")

[Package Rdbi version 1.6.0 Index]