digest2int

0th

Percentile

hash arbitrary string to integer

The digest2int function calculates integer hash of an arbitrary string. This is useful for radnomized experiments, feature hashing, etc.

Keywords
misc
Usage
digest2int(x, seed = 0L)
Arguments
x

An arbitrary character vector.

seed

an integer for algorithm initial state. Function will produce different hashes for same input and different seed values.

Value

The digest2int function returns integer vector of the same length as input vector x.

References

Jenkins's one_at_a_time hash: https://en.wikipedia.org/wiki/Jenkins_hash_function#one_at_a_time.

See Also

digest

Aliases
  • digest2int
Examples
# NOT RUN {
current <- digest2int("The quick brown fox jumps over the lazy dog", 0L)
target <- 1369346549L
stopifnot(identical(target, current))

# }
Documentation reproduced from package digest, version 0.6.21, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.