| sub-.ordered_sequence | R Documentation |
Read indexing treats vectors as selectors and returns subsets in key order. Out-of-order selectors are canonicalized with a warning. Replacement indexing is blocked to prevent order-breaking writes.
## S3 method for class 'ordered_sequence'
x[i, ...]
## S3 method for class 'ordered_sequence'
x[[i, ...]]
## S3 replacement method for class 'ordered_sequence'
x[i] <- value
## S3 replacement method for class 'ordered_sequence'
x[[i]] <- value
## S3 method for class 'ordered_sequence'
x$name
## S3 replacement method for class 'ordered_sequence'
x$name <- value
x |
An |
i |
Index input. |
... |
Unused. |
value |
Replacement value (unsupported). |
name |
Element name (for |
Vector selectors are treated as membership selectors, not output-order instructions.
Integer/character vectors are normalized to unique positions and returned in canonical sequence order.
Out-of-order selector vectors trigger a warning and are canonicalized.
Duplicate selectors are rejected.
Replacement indexing ([<-, [[<-, $<-) is unsupported.
Read methods return ordered payload values/subsets; replacement forms always error.
x <- ordered_sequence(a = "A", b = "B", c = "C", keys = c(1, 2, 3))
x[c(3, 1)] # warning; result returned in key order
x[c("c", "a")] # warning; result returned in key order
x[c(TRUE, FALSE, TRUE)]
x[["b"]]
x$b
try(x[c(2, 2)])
try(x$b <- "updated")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.