Learn R Programming

NetRep (version 1.0.2)

vCat: Verbose Concatenate and Print with Indentation

Description

Concatenate and output the objects only if the verbose flag is set to TRUE. Allows for indentation, adding a series of spaces to the beginning of each line, 2 for every increment in ind.

Usage

vCat(verbose, ind = 0, ..., sep = " ", fill = TRUE, labels = NULL)

Arguments

verbose
logical. If TRUE, passes the rest of the arguments to cat
ind
an integer corresponding to the level of indentation. Each indentation level corresponds to two spaces.
...
Arguments to pass to cat
sep
a character vector of strings to append after each element.
fill
a logical or (positive) numeric controlling how the output is broken into successive lines. If FALSE, only newlines created explicitly by "\n" are printed. Otherwise, the output is broken into lines with print width equal to the option width if fill is TRUE (default), or the value of fill if this is numeric. Non-positive fill values are ignored, with a warning.
labels
character vector of labels for the lines printed. Ignored if fill is FALSE.

Details

vCat is slightly more intelligent than regulat cat in the way it formats the output and breaks it into lines. As a result, fill is set to TRUE by default. Another notable difference from cat is the way newline objects are handled. For example, the call: cat("hello", "world", "\n", "foo", "bar") won't wrap the newline character with spaces. This avoids the need to set sep to "" and embed multiple paste calls. Finally, a newline character is appended to the end of the whole message, avoiding the need to manually specify this when calling vCat.

See Also

cat