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
. IfNULL
, 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 notNULL
.
Examples
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.')
#> The quick brown fox jumps over the lazy Susan.
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', breaks=10)
#> The quick
#> brown fox
#> jumps over
#> the lazy Susan.
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', level=1)
#>
#> ######################################################
#> ### The quick brown fox jumps over the lazy Susan. ###
#> ######################################################
#>
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', level=2)
#>
#> ### The quick brown fox jumps over the lazy Susan. ###
#> ######################################################
#>
say('The quick brown fox ', 'jumps over the lazy ', 'Susan.', level=3)
#>
#> ### The quick brown fox jumps over the lazy Susan.
#>