qMap: qMap

Description Usage Arguments Value Description Q-Words Author(s) Examples

View source: R/qMap.R

Description

qMap maps numbers to Q-words, or Q-words to their index in (0, 1023).

Usage

1
qMap(x)

Arguments

x

(character or numeric) A vector.

Value

(numeric or character) A vector of indices, Q-words, or NA of the same length as the input.

Description

qMap accepts strings that are matched to Q-word indices or NA, or numbers that are matched to Q-words or NA. The returned vector has the same length as the input. Numbers that are not in (0, 1023) return NA. Strings that are not a Q-word return NA. qMap(0) is "aims", qMap(1023) is "zone". Note: the first Q-word has index 0, since it represents the bit-pattern "0000000000".

Q-Words

A table of 1,024 four-letter words is encoded in this function. Four-letter English words were chosen and manually refined to yield short, unique labels that:

The table is alphabetically sorted.

Author(s)

(c) 2019 Boris Steipe, licensed under MIT (see file LICENSE in this package).

Examples

1
2
3
4
5
6
# qMap a number
qMap(313)                                    # "gift"
# qMap four words, three can be matched.
qMap(c("three", "free", "cold", "beer"))     # NA 287  125  34
# return the entire QQ table
x <- qMap(0:1023)

qqid documentation built on May 2, 2019, 12:19 p.m.