encode_value: Encode Value

View source: R/encode_value.R

encode_valueR Documentation

Encode Value

Description

Takes a vector and returns an integer that is a product of the prime keys corresponding to the values in the vector. The second argument takes an encoding key as generated by make_encoding_key(). Values can be decoded using decode_value().

Usage

encode_value(values_to_encode, prime_key)

Arguments

values_to_encode

A vector of values to encode.

prime_key

An encoding key, as generated by make_encoding_key().

Value

A double, containing an integer value.

See Also

make_encoding_key()

decode_value()

Examples

# Generate a product equal to 15.
encoded_value <- encode_value(c('Mammal', 'Bird'), c(Fish = 2, Mammal = 3, Bird = 5))

JonasEngstrom/primr documentation built on June 9, 2022, 9:43 p.m.