format_vector(
x = vector(),
label = NULL,
level = 0L,
indent = 1L,
fill_names = FALSE,
null = "",
empty = "",
validate = TRUE
) A character vector, possibly trimmed by str_trim().
A vector of any atomic mode, a list, or a pairlist. It can be empty and it can contain NA values.
A NULL, or a non-empty and non-NA character string. A top
descriptive label for x. It is used to preserve, and output all names
in recursive calls. The value passed to label is considered to be at
level 0, and is not indented.
A non-NA integer value. The current depth, or current nesting level to use for indentation purposes.
A non-NA integer value. The number of single space(s) to use
for each level when indenting name/value pairs.
A non-NA logical value. Should NULL and empty names
be replaced by names created from the elements' underlying positions?
Positions are relative to each level.
A non-empty and non-NA character string. The value to use to
represent NULL and empty parlists (they are conceptually the same thing).
A non-empty and non-NA character string. The value to use to
represent empty vectors, excluding NULL. See null above for the latter.
The type of the underlying empty object is added to empty
for convenience. See Examples below.
A non-NA logical value. Should the arguments be validated before being used? This argument should be left as is.
format_vector() is an alternative to utils::str() that exposes a much
simpler generic formatting interface and yields terser outputs of name/value
pairs. Indentation is used for nested values.
format_vector() does not attempt to cover all R objects like
utils::str(). Instead, it (merely) focuses on efficiently handling the
types used by transltr. It is the low-level workhorse function of
format.Translator(), format.Text(), and format.Location().
str_trim()
Other utility functions:
stops(),
str_to(),
vapply_1l()