| list_of {vctrs} | R Documentation |
list_of S3 class for homogenous listsA list_of object is a list where each element has the same type.
Modifying the list with $, [, and [[ preserves the constraint
by coercing all input items.
list_of(..., .ptype = NULL) as_list_of(x, ...) validate_list_of(x) is_list_of(x) ## S3 method for class 'vctrs_list_of' vec_ptype2(x, y, ..., x_arg = "", y_arg = "") ## S3 method for class 'vctrs_list_of' vec_cast(x, to, ...)
... |
Vectors to coerce. |
.ptype |
If Alternatively, you can supply |
x |
For |
y, to |
Arguments to |
x_arg |
Argument names for |
y_arg |
Argument names for |
Unlike regular lists, setting a list element to NULL using [[
does not remove it.
x <- list_of(1:3, 5:6, 10:15)
if (requireNamespace("tibble", quietly = TRUE)) {
tibble::tibble(x = x)
}
vec_c(list_of(1, 2), list_of(FALSE, TRUE))