Description Usage Arguments Details Value See Also Examples
Get or set the keys associated with a set of values.
1 2 |
x |
an object. |
value |
keys for |
A dataset
object and other similar objects can have a
keys
attribute identifying the data values in the object. This
attribute is a dataset with unique rows, called a keyset
.
Use keys(x)
to retrieve the keys attribute for the rows in x
.
Use keys(x)<- value
to set attribute, or keys(x) <- NULL
to
drop the keys.
keys(x)
is a keyset with the same number of rows as x
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # data.frame objects do not have keys
keys(mtcars)
# you can set keys on datasets
x <- as.dataset(mtcars)
keys(x) <- keyset(name = rownames(mtcars))
# 'keys' can be scalar...
keys(x) <- runif(32)
# ...or 'keys' can have multiple columns
keys(x) <- keyset(k1 = rep(LETTERS[1:4], each = 8),
k2 = rep(1:8, 4))
# set 'keys' to NULL to remove
keys(x) <- NULL
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.