say: Nicer version of 'print()' or 'cat()' function

View source: R/say.r

sayR Documentation

Nicer version of print() or cat() function

Description

This function is a nicer version of print() or cat(), especially when used inline for functions because it displays immediately and pastes all strings together. It also does some rudimentary but optional word wrapping.

Usage

say(
  ...,
  pre = 0,
  post = 1,
  breaks = NULL,
  wiggle = 10,
  preBreak = 1,
  level = NULL,
  deco = "#"
)

Arguments

...

Character strings to print

pre

Integer >= 0. Number of blank lines to print before strings

post

Integer >= 0. Number of blank lines to print after strings

breaks

Either NULL, which causes all strings to be printed on the same line (no wrap overflow) or a positive integer which wraps lines at this character length (e.g., breaks=80 inserts line breaks every 80 characters).

wiggle

Integer >- 0. Allows line to overrun breaks length in characters before inserting line breaks.

preBreak

If wrapping long lines indicates how subsequent lines are indented. NULL causes lines to be printed starting at column 1 on the display device. A positive integer inserts preBreak number of spaces before printing each line. A string causes each line to start with this string.

level

Integer or NULL. If NULL, then the items in ... are displayed as-is. Otherwise, a value of 1, 2, or 3 indicates teh heading level, with lower numbers causing more decoration and spacing to be used.

deco

Character. Character to decorate text with if level is not NULL.

Value

Nothing (side effect is output on the display device).

Examples


say('The quick brown fox ', 'jumps over the lazy ', 'Susan.')
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', breaks=10)
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', level=1)
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', level=2)
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', level=3)


adamlilith/omnibus documentation built on May 3, 2024, 9:49 a.m.