opts_atomic {constructive}R Documentation

Constructive options for atomic types

Description

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.

Usage

opts_atomic(
  ...,
  trim = NULL,
  fill = c("default", "rlang", "+", "...", "none"),
  compress = TRUE
)

Arguments

...

Additional options used by user defined constructors through the opts object

trim

NULL or integerish. Maximum of elements showed before it's trimmed. Note that it will necessarily produce code that doesn't reproduce the input. This code will parse without failure but its evaluation might fail.

fill

String. Method to use to represent the trimmed elements.

compress

Boolean. If TRUE instead of c() Use seq(), rep() when relevant to simplify the output.

Details

If trim is provided, depending on fill we will present trimmed elements as followed:

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.

Value

An object of class <constructive_options/constructive_options_atomic>

Examples

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"))

[Package constructive version 1.0.1 Index]