text2color: Map Words to Colors

Description Usage Arguments Value See Also Examples

Description

A dictionary lookup that maps words to colors.

Usage

1
  text2color(words, recode.words, colors)

Arguments

words

A vector of words.

recode.words

A vector of unique words or a list of unique word vectors that will be matched against corresponding colors.

colors

A vector of colors of equal in length to recode.words + 1(the +1 is for unmatched words).

Value

Returns a vector of mapped colors equal in length to the words vector.

See Also

lookup

Examples

1
2
3
4
5
6
7
8
9
set.seed(10)
x <- data.frame(X1 = sample(Top25Words[1:10], 20, TRUE))

#blue was recycled
text2color(x$X1, qcv(the, and, is), qcv(red, green, blue))
text2color(x$X1, qcv(the, and, is), qcv(red, green, blue, white))
x$X2 <- text2color(x$X1, list(qcv(the, and, is), "that"),
    qcv(red, green, white))
x

trinker/qdap2 documentation built on May 31, 2019, 9:47 p.m.