fl: An indented, wrapped list styled after a definition.

Description Usage Arguments Value Functions R Trivia Examples

Description

There are many formatting or pretty printing functions available, some of them quite elaborate. Mine uses only functions in base. It seems that many programmers don't realize the power of strwrap and the sep parameter for cat.

An indented, wrapped list styled after a definition.

Usage

1
2
3
fl(x, label = "", indent_string = NA)

flp(x, label = "", indent_string = NA)

Arguments

x

the R object to display. toString must be able to evaluate it.

label

a string to describe the list. The remaining lines are indented by the number of characters from catcatenating indent_string and 'label'.

indent_string

the string to prefix the first line. Defaults to tab.width option number of spaces. If you wanted your list indented 4 spaces, pass a string of 4 spaces to this parameter.

Value

a formatted string

Functions

R Trivia

Turns out the tab.width option is not set by default in base R as I discovered when I tried to build the package. Now explicitly test to see if the option is set.

Examples

1
2
3
fl(search(), label = "search():  ")

s <- flp(search(), label = "search():  ")

dgabbe/dgutil documentation built on May 15, 2019, 7:20 a.m.