| as_short_string {mlr3misc} | R Documentation |
Convert R Object to a Descriptive String
Description
This function is intended to be convert any R object to a short descriptive string,
e.g. in base::print() functions.
The following rules apply:
if
xisatomic()with length 0 or 1: printed as-is.if
xisatomic()with length greater than 1,xis collapsed with",", and the resulting string is truncated totrunc_widthcharacters.if
xis an expression: converted to character.Otherwise: the class is printed.
If x is a list, the above rules are applied (non-recursively) to its elements.
Usage
as_short_string(x, width = 30L, num_format = "%.4g")
Arguments
x |
( |
width |
( |
num_format |
( |
Value
(character(1)).
Examples
as_short_string(list(a = 1, b = NULL, "foo", c = 1:10))
[Package mlr3misc version 0.15.1 Index]