indexed | R Documentation |
A simple class for indexed data.
indexed(x, i, ...)
x |
An atomic vector or |
i |
An optional vector of indices (dafaults to |
... |
Other arguments passed to methods. |
An object identical to x
but with the additional class
indexed
and a indices
attribute.
x <- c(3.7, 3.3, 3.5, 2.8)
y <- c(1, 2, 1, 2)
z <- indexed(x=x)
indices(z)
indices(z[2:3]) # Indices are preserved
d <- indexed(
data.frame(
x=x,
y=y
)
)
indices(d)
indices(d[[1]])
indices(d$x)
indices(subset(d, y==1))
lapply(split(d, d$y), indices)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.