R: Hash object

Hash object {Rfast} | R Documentation

## Hash object

### Description

Hash object.

### Usage

    Hash(keys=NULL,values=NULL)
    Hash.key.multi(x,...,sep = " ")
    ## S3 replacement method for class 'Hash'
    x[...,sep = " "] <- value
    ## S3 method for class 'Hash'
    x[...,sep = " "]
    ## S3 method for class 'Hash'
    print(x,...)
    ## S3 method for class 'Hash'
    length(x)

### Arguments

`x` | A Hash object, using Hash function.
`values` | A vector with the values you want to store.
`value` | The values you want to store.
`keys` | A vector with keys for each values.
`sep` | A character value using to separate the multiple keys for each value.
`...` | One or more values for access or find elements.

### Details

If you want to delete a key just insert the global variable "Rfast:::delete".

Hash: Create Hash object where every key has a value. Specify the type from the beggining (for speed). Use the argument "type" with one of the values "new.env, logical, character, integer, numeric". Hash.key.multi: search if key exists. If the keys are multiple, then use the argument "substr" to search inside each multiple for the specific key.

### Value

A Hash object.

### Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

### See Also

`hash.list, hash.find`

### Examples

    x <- Hash(rnorm(10),sample(1:10))

    x[1,2,13] <- 0.1234 # insert value using multi key. the same as x["1 2 13"] <- 0.1234
    x[1,2,3] <- 15 # insert value using multi key. the same as x["1 2 3"] <- 15

    Hash.key.multi(x,"1")
    x # print Hash object using S3 generic
    #x[1,2,3] <- Rfast:::delete # delete multi key. the same as x["1 2 3"] <- NULL
    length(x)

[Package Rfast version 2.0.0 Index]