Description Usage Arguments Details Value Author(s) See Also Examples
Function to center text strings for display on the text console by prepending the necessary number of spaces to each element.
1 | centerText(x, width = getOption("width"))
|
x |
Character vector containing text strings to be centered. |
width |
Desired display width. Defaults to the R display width
given by |
Each element will be centered individually by prepending the necessary number of spaces to center the text in the specified display width assuming a fixed width font.
Vector of character strings.
Gregory R. Warnes greg@warnes.net
1 2 3 4 5 6 7 8 9 | cat(centerText("One Line Test"), "\n\n")
mText <-c("This", "is an example",
" of a multiline text ",
"with ",
" leading",
" and trailing ",
"spaces.")
cat("\n", centerText(mText), "\n", sep="\n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.