format {utils} | R Documentation |
Format unordered (itemize) and ordered (enumerate) lists.
formatUL(x, label = "*", offset = 0,
width = 0.9 * getOption("width"))
formatOL(x, type = "arabic", offset = 0, start = 1,
width = 0.9 * getOption("width"))
x |
a character vector of list items. |
label |
a character string used for labelling the items. |
offset |
a non-negative integer giving the offset (indentation) of the list. |
width |
a positive integer giving the target column for wrapping lines in the output. |
type |
a character string specifying the ‘type’ of the
labels in the ordered list. If |
start |
a positive integer specifying the starting number of the first item in an ordered list. |
A character vector with the formatted entries.
formatDL
for formatting description lists.
## A simpler recipe.
x <- c("Mix dry ingredients thoroughly.",
"Pour in wet ingredients.",
"Mix for 10 minutes.",
"Bake for one hour at 300 degrees.")
## Format and output as an unordered list.
writeLines(formatUL(x))
## Format and output as an ordered list.
writeLines(formatOL(x))
## Ordered list using lower case roman numerals.
writeLines(formatOL(x, type = "i"))
## Ordered list using upper case letters and some offset.
writeLines(formatOL(x, type = "A", offset = 5))