make_encoding_key: Make Encoding Key

View source: R/make_encoding_key.R

make_encoding_keyR Documentation

Make Encoding Key

Description

Takes a vector of values and pairs them with prime numbers. The pairs can then be used for encoding by encode_value(), decoding by decode_value(). If there are several identical values in the input vector, only one prime number per unique value is returned.

Usage

make_encoding_key(values_to_encode)

Arguments

values_to_encode

A vector containing all unique values to encode.

Value

A vector of prime numbers with names corresponding to the values to be encoded.

See Also

encode_value()

decode_value()

Examples

# Return a key of three prime numbers for three categories.
prime_key <- make_encoding_key(c("Mammal", "Bird", "Fish"))

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