| opts_list {constructive} | R Documentation |
Constructive options for type 'list'
Description
These options will be used on objects of type 'list'.
Usage
opts_list(
constructor = c("list", "list2"),
...,
trim = NULL,
fill = c("vector", "new_list", "+", "...", "none")
)
Arguments
constructor |
String. Name of the function used to construct the object, see Details section. |
... |
Additional options used by user defined constructors through the |
trim |
|
fill |
String. Method to use to represent the trimmed elements. |
Details
Depending on constructor, we construct the object as follows:
-
"list"(default): Build the object by callinglist(). -
"list2": Build the object by callingrlang::list2(), the only difference with the above is that we keep a trailing comma when the list is not trimmed and the call spans several lines.
If trim is provided, depending on fill we will present trimmed elements as followed:
-
"vector"(default): Usevector(), so for instancelist("a", "b", "c")might becomec(list("a"), vector("list", 2)). -
"new_list": Userlang::new_list(), so for instancelist("a", "b", "c")might becomec(list("a"), rlang::new_list(2)). -
"+": Use unary+, so for instancelist("a", "b", "c")might becomelist("a", +2). -
"...": Use..., so for instancelist("a", "b", "c")might becomelist("a", ...) -
"none": Don't represent trimmed elements.
When trim is used the output is parsable but might not be possible to evaluate,
especially with fill = "...". In that case you might want to set check = FALSE
Value
An object of class <constructive_options/constructive_options_list>