toLookupClass | R Documentation |
Provide the mapping between keys and values in a structure of choice
toLookupClass(
keys,
values,
class = c("data.frame.1", "data.frame.2", "list", "vector")[1]
)
keys |
vector of keys |
values |
vector of values |
class |
character string determining the class of the structure
returned: "data.frame.1": data frame with the |
object according to the chosen class
. See description of the
class
argument.
keys <- c("A", "B", "C")
values <- c("Apple", "Banana", "Cherry")
fruits.df1 <- toLookupClass(keys, values)
fruits.df2 <- toLookupClass(keys, values, class = "data.frame.2")
fruits.list <- toLookupClass(keys, values, class = "list")
fruits.vector <- toLookupClass(keys, values, class = "vector")
# Note how you may use the results differently
fruits.df1$A
fruits.list$A
fruits.vector["A"]
fruits.df1[c("A", "C")]
fruits.list[c("A", "C")]
fruits.vector[c("A", "C")]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.