opts_atomic | R Documentation |
These options will be used on atomic types ("logical", "integer", "numeric", "complex", "character" and "raw").
They can also be directly provided to atomic types through their own opts_*()
function, and in this case the latter will have precedence.
opts_atomic(
...,
trim = NULL,
fill = c("default", "rlang", "+", "...", "none"),
compress = TRUE
)
... |
Additional options used by user defined constructors through the |
trim |
|
fill |
String. Method to use to represent the trimmed elements. |
compress |
Boolean. If |
If trim
is provided, depending on fill
we will present trimmed elements as followed:
"default"
: Use default atomic constructors, so for instance c("a", "b", "c")
might become c("a", character(2))
.
"rlang"
: Use rlang atomic constructors, so for instance c("a", "b", "c")
might become c("a", rlang::new_character(2))
,
these rlang
constructors create vectors of NAs
, so it's different from the default option.
"+"
: Use unary +
, so for instance c("a", "b", "c")
might become c("a", +2)
.
"..."
: Use ...
, so for instance c("a", "b", "c")
might become c("a", ...)
"none"
: Don't represent trimmed elements.
Depending on the case some or all of the choices above might generate code that cannot be executed. The 2 former options above are the most likely to succeed and produce an output of the same type and dimensions recursively. This would at least be the case for data frame.
An object of class <constructive_options/constructive_options_atomic>
construct(iris, opts_atomic(trim = 2), check = FALSE) # fill = "default"
construct(iris, opts_atomic(trim = 2, fill = "rlang"), check = FALSE)
construct(iris, opts_atomic(trim = 2, fill = "+"), check = FALSE)
construct(iris, opts_atomic(trim = 2, fill = "..."), check = FALSE)
construct(iris, opts_atomic(trim = 2, fill = "none"), check = FALSE)
construct(iris, opts_atomic(trim = 2, fill = "none"), check = FALSE)
x <- c("a a", "a\U000000A0a", "a\U00002002a", "\U430 \U430")
construct(x, opts_atomic(unicode_representation = "unicode"))
construct(x, opts_atomic(unicode_representation = "character"))
construct(x, opts_atomic(unicode_representation = "latin"))
construct(x, opts_atomic(unicode_representation = "ascii"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.