word_value: Converts a Vector of Words to Numeric Values Based on Letter...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/word_value.R

Description

Uses the numeric position of the letters in a word to create a numeric value for a word.

Usage

1
word_value(words, dtOut = FALSE)

Arguments

words

The input vector of words.

dtOut

Logical. Should the output be a data.table comprising the words and the values. Defaults to FALSE.

Details

The function converts the input to lowercase, removes anything that is not between the letters "a" and "z", and transliterates accented characters to their ASCII equivalent before converting the word to a numeric value.

Value

A named numeric vector or a data.table.

Author(s)

Ananda Mahto and Jota.

References

http://stackoverflow.com/q/36097446/1270695

Examples

1
2
3
4
myvec <- c("and", "dad", "cat", "fox", "mom", 
           "add", "dan", "naive", "non-descript")
word_value(myvec)
word_value(myvec, TRUE)

mrdwab/SOfun documentation built on June 20, 2020, 6:15 p.m.