| hash_table | R Documentation |
Hash table implemented by std::unordered_map
hash_table(keys, values)
## S4 method for signature 'hash_unordered_map'
hash_values(h, keys = NULL)
## S4 method for signature 'hash_unordered_map'
hash_exists(h, keys)
## S4 method for signature 'hash_unordered_map'
hash_insert(h, keys, values)
## S4 method for signature 'hash_unordered_map'
hash_delete(h, keys)
## S4 method for signature 'hash_unordered_map'
hash_size(h)
## S3 method for class 'hash_unordered_map'
length(x)
## S4 method for signature 'hash_unordered_map'
hash_keys(h)
## S4 method for signature 'hash_unordered_map'
hash_copy(h)
## S3 method for class 'hash_unordered_map'
x[[i]]
## S3 method for class 'hash_unordered_map'
x[i]
## S3 method for class 'hash_unordered_map'
x$name
## S3 replacement method for class 'hash_unordered_map'
x[[i]] <- value
## S3 replacement method for class 'hash_unordered_map'
x[i] <- value
## S3 replacement method for class 'hash_unordered_map'
x$name <- value
## S4 method for signature 'hash_unordered_map'
show(object)
as.hash_table(x)
## Default S3 method:
as.hash_table(x)
## S3 method for class 'hash_unordered_map'
as.vector(x, mode = "any")
## S3 method for class 'hash_unordered_map'
as.list(x, ...)
keys |
A character vector. Keys should have no duplicates. |
values |
An atomic vector or a list. |
h, x, object |
A |
i, name, value |
Keys and values. |
mode, ... |
Please ignore. |
hash_values() and [ methods preserve the original format of values, which means, if values
was specified as an atomic vector, the two functions also returns atomic vectors.
hash_table(), hash_insert(), hash_delete(), hash_copy() returns a hash_unordered_map object.
hash_exists() returns a logical vector. hash_size() returns an integer. hash_keys() returns
a character vector. hash_values() returns a vector of a list which has the same format as in the
constructor function.
hash_table(c("a", "b"), 1:2L)
hash_table(c("a", "b"), c(TRUE, FALSE))
hash_table(c("a", "b"), c(0.1, 0.2))
hash_table(c("a", "b"), c("one", "two"))
hash_table(c("a", "b"), as.Date(c("2025-01-01", "2025-02-01")))
hash_table(c("a", "b"), as.POSIXct(c("2025-01-01 00:00:01", "2025-02-01 00:00:01")))
hash_table(c("a", "b"), list(1:10, letters))
h = hash_table(letters, 1:26)
hash_keys(h)
hash_values(h)
hash_exists(h, c("a", "b", "foo"))
hash_delete(h, letters[1:20]); h
hash_insert(h, "foo", 100L)
h = hash_table(letters, 1:26)
h$a
h[["a"]]
h[c("a", "b")]
as.vector(h)
as.list(h)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.