hash_env: Hash table and hash set implemented by environment

hash_env_tableR Documentation

Hash table and hash set implemented by environment

Description

Hash table and hash set implemented by environment

Usage

hash_env_table(keys, values)

hash_env_set(keys)

## S4 method for signature 'hash_env'
hash_exists(h, keys)

## S4 method for signature 'hash_env'
hash_delete(h, keys)

## S4 method for signature 'hash_env_table'
hash_insert(h, keys, values)

## S4 method for signature 'hash_env_set'
hash_insert(h, keys)

## S4 method for signature 'hash_env'
hash_size(h)

## S3 method for class 'hash_env'
length(x)

## S4 method for signature 'hash_env'
hash_keys(h)

## S4 method for signature 'hash_env_table'
hash_values(h, keys = NULL)

## S4 method for signature 'hash_env_set'
hash_values(h, keys = NULL)

## S4 method for signature 'hash_env'
hash_copy(h)

## S3 method for class 'hash_env_table'
x[[i]]

## S3 method for class 'hash_env_set'
x[[i]]

## S3 replacement method for class 'hash_env_table'
x[[i]] <- value

## S3 method for class 'hash_env_table'
x[i]

## S3 method for class 'hash_env_set'
x[i]

## S3 replacement method for class 'hash_env_table'
x[i] <- value

## S3 method for class 'hash_env'
x$name

## S3 replacement method for class 'hash_env_table'
x$i <- value

## S3 replacement method for class 'hash_env_set'
x[[i]] <- value

## S3 replacement method for class 'hash_env_set'
x[i] <- value

## S3 replacement method for class 'hash_env_set'
x$name <- value

as.hash_env(x)

## Default S3 method:
as.hash_env(x)

## S3 method for class 'hash_env_set'
as.vector(x, mode = "any")

## S3 method for class 'hash_env_table'
as.vector(x, mode = "any")

## S3 method for class 'hash_env_table'
as.list(x, ...)

## S4 method for signature 'hash_env_table'
show(object)

## S4 method for signature 'hash_env_set'
show(object)

Arguments

keys

A character vector. Keys should have no duplicates.

values

An atomic vector or a list.

h, x, object

A hash_env_table returned by hash_env_table() or a hash_env_set object returned by hash_env_set().

i, name, value

Keys and values.

mode, ...

Please ignore.

Details

hash_values() and [ methods on the hash_env_table object preserve the original format of values, which means, if values was specified as an atomic vector, the two functions also returns atomic vectors.

Value

hash_env_table() returns a hash_env_table object. hash_env_set() returns a hash_env_set object. hash_env_delete(), hash_env_insert(), hash_env_copy() return a hash_env_table object or a hash_env_set object. hash_exists() returns a logical vector. hash_size() returns an integer. hash_keys() returns a character vector. hash_values() on the hash_env_table object returns a vector of a list which has the same format as in the constructor function. hash_values() on the hash_env_set object throws an error.

Examples

h = hash_env_table(letters, 1:26)
hash_keys(h)
hash_values(h)
h$a

h = hash_env_set(letters)
hash_exists(h, "a")

hashtable documentation built on July 27, 2026, 5:09 p.m.