Nothing
## -----------------------------------------------------------------------------
library(hashtable)
h1 = hash_table(letters, 1:26)
h2 = hash_fm_table(letters, 1:26)
h3 = hash_env_table(letters, 1:26)
h1
h2
h3
## -----------------------------------------------------------------------------
hash_keys(h1)
## -----------------------------------------------------------------------------
hash_values(h1)
## -----------------------------------------------------------------------------
hash_values(h1, c("a", "b", "c"))
## -----------------------------------------------------------------------------
h1$a
h1[["a"]]
h1[c("a", "b")]
## -----------------------------------------------------------------------------
hash_exists(h1, c("a", "b", "foo"))
## -----------------------------------------------------------------------------
hash_delete(h1, c("a", "b"))
hash_exists(h1, c("a", "b"))
## -----------------------------------------------------------------------------
hash_insert(h1, "c", 100L); h1$c
hash_insert(h1, "c", -1L); h1$c
hash_insert(h1, "foo", 0L); h1$foo
## -----------------------------------------------------------------------------
h1$a = 20L; h1$a
h1[["bar"]] = -100L; h1$bar
h1[c("c", "d", "e")] = c(-1L, -2L, -3L); h1[c("c", "d", "e")]
## -----------------------------------------------------------------------------
h1 = hash_table(c("a", "b"), list(1L, "text"))
h1
h1$c = 3.14
h1$d = lm(1~1) # an lm object
h1
## -----------------------------------------------------------------------------
h1 = hash_table(c("a", "b"), 1:2)
as.vector(h1)
h1 = hash_table(c("a", "b"), list(1L, "text"))
as.vector(h1)
vec = structure(1:2, names = c("a", "b"))
as.hash_table(vec)
lt = structure(list(1L, "text"), names = c("a", "b"))
as.hash_table(lt)
## -----------------------------------------------------------------------------
h1 = hash_set(letters)
h2 = hash_fm_set(letters)
h3 = hash_env_set(letters)
h1
## -----------------------------------------------------------------------------
hash_keys(h1)
## ----error = TRUE-------------------------------------------------------------
hash_values(h1)
## -----------------------------------------------------------------------------
hash_exists(h1, c("a", "foo"))
## -----------------------------------------------------------------------------
hash_insert(h1, "foo")
hash_exists(h1, "foo")
## -----------------------------------------------------------------------------
hash_delete(h1, "foo")
hash_exists(h1, "foo")
## -----------------------------------------------------------------------------
h1$a
h1[["a"]]
h1$foo
h1[c("a", "b", "foo")]
## -----------------------------------------------------------------------------
h1$a = FALSE
hash_exists(h1, "a")
h1$foo = TRUE
hash_exists(h1, "foo")
## -----------------------------------------------------------------------------
as.vector(h1)
as.hash_set(letters)
## ----error = TRUE-------------------------------------------------------------
h = hash_fm_table(letters, 1:26)
h$a = 100L
## ----error = TRUE-------------------------------------------------------------
h$foo = 1L # insert new key foo
hash_delete(h, "a")
## ----error = TRUE-------------------------------------------------------------
h = hash_fm_set(letters)
h$a = FALSE
h$foo = TRUE
## -----------------------------------------------------------------------------
sessionInfo()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.