Coerce to a keyvalue object
Source:R/as.keyvalue.R, R/as.keyvalue.data.frame.R, R/as.keyvalue.default.R, and 1 more
keyvalue.RdFunctions to check if an object is a keyvalue object, or coerce it if possible.
Usage
as.keyvalue(x, ...)
# S3 method for class 'data.frame'
as.keyvalue(x, standard_var_names = NULL, ...)
# Default S3 method
as.keyvalue(x, y, ...)
is.keyvalue(x)Value
as.keyvalue returns a data.frame with additional class
keyvalue that fulfills the requirements for a keyvalue object
and with the key column as character. It also has two extra attributes
standard_var_names as described above and keyvalue11 which is
TRUE for keyvalue objects with a 1:1 relation between its keys and
values (otherwise FALSE).
Details
x can be of:
a name of a package internal (or external) keyvalue object (character of length one)
a
data.framewith two columns "key" (with unique cells) and "value".a list as described in
as.keyvalue.lista named vector with all names unique
an unnamed vector with unique cells if supplemented by additional vector (y)
Examples
snomed2 <- as.keyvalue(snomed)
is.keyvalue(snomed2)
#> [1] TRUE
summary(snomed2)
#> Error in derive_pubkey(key): RAW() can only be applied to a 'raw', not a 'character'