formatDL(x, y, style = c("table", "list"), width = 0.9 * getOption("width"), indent = NULL)
x | a character vector containing tags, or a length-2 list containing the tag and description vectors, or a 2-column character matrix containing the tag and description columns, or a character vector with names(names are tags, and elements are descriptions). The lengths of tags and descriptions must be same. |
y | a character vector containing the corresponding descriptions. Ignored if x is a list or matrix. (If x is a vector with names and y is supplied, then the names on x are ignored, its values are used as the tags, and the values in y are used as the descriptions.) |
style | a character string specifying the format style. Must be "table" or "list", partial matching is allowed. |
width | A small positive integer. Line breaks will be inserted into the descriptions so that, if possible, when printed with cat(sep="\n", formatDL(..., width=width)) the printed lines will be no longer than width characters. |
indent |
a non-negative integer. For "table" style, this specifies the indention of the
description lines, both the first and the continuation lines.
For "list" style this specifies the indentation of continuation lines (the first
line always starts right after the colon that follows the tag).
indent must not be greater than width/2. The default value, NULL, means width/3 for "table" style and width/9 for "list" style. |
cat(sep="\n", formatDL(c(One="First number", Two="Second number", Three="Third number"))) # 3 more ways to make the same thing cat(sep="\n", formatDL(c("One", "Two", "Three"), c("First number", "Second number", "Third number"))) cat(sep="\n", formatDL(list(c("One", "Two", "Three"), c("First number", "Second number", "Third number")))) cat(sep="\n", formatDL(cbind(c("One", "Two", "Three"), c("First number", "Second number", "Third number")))) # 2 ways to reduce space between tags and descriptions cat(sep="\n", formatDL(c(One="First number", Two="Second number", Three="Third number"), indent=10)) cat(sep="\n", formatDL(c(One="First number", Two="Second number", Three="Third number"), width=24))# "list" style cat(sep="\n", formatDL(c(One="First number", Two="Second number", Third="Third number"), style="list"))
# line wrapping cat(sep="\n", formatDL(c(One="The most important concern", Two="A secondary concern", Miscellaneous="Matters of little interest to us"), width=35)) cat(sep="\n", formatDL(c(One="The most important concern", Two="A secondary concern", Miscellaneous="Matters of little interest to us"), width=35, style="list"))