hash_fm: Hash table and hash set implemented by fastmatch

hash_fm_tableR Documentation

Hash table and hash set implemented by fastmatch

Description

Hash table and hash set implemented by fastmatch

Usage

hash_fm_table(keys, values)

hash_fm_set(keys)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

as.hash_fm(x)

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

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

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

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

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

## S4 method for signature 'hash_fm_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_fm_table object returned by hash_fm_table() or a hash_fm_set object returned by hash_fm_set().

i, name, value

Keys and values.

mode, ...

Please ignore.

Details

hash_values() and [ methods on the hash_fm_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.

Once the hash table or the hash set is created, it is not allowed to modify.

Value

hash_fm_table() returns a hash_fm_table object. hash_fm_set() returns a hash_fm_set object. hash_fm_delete(), hash_fm_insert(), hash_fm_copy() return a hash_fm_table object or a hash_fm_set object. hash_exists() returns a logical vector. hash_size() returns an integer. hash_keys() returns a character vector. hash_values() on the hash_fm_table object returns a vector of a list which has the same format as in the constructor function. hash_values() on the hash_fm_set object throws an error.

Examples

h = hash_fm_table(letters, 1:26)
hash_keys(h)
hash_values(h)
h$a
try(h$a <- 2L)

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

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