R/word_value.R
word_value.Rd
Uses the numeric position of the letters in a word to create a numeric value for a word.
word_value(words, dtOut = FALSE)
words | The input vector of words. |
---|---|
dtOut | Logical. Should the output be a |
A named numeric vector or a data.table
.
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.
http://stackoverflow.com/q/36097446/1270695
Ananda Mahto and Jota.
myvec <- c("and", "dad", "cat", "fox", "mom", "add", "dan", "naive", "non-descript") word_value(myvec)#> and dad cat fox mom add #> 19 9 24 45 41 9 #> dan naive nondescript #> 19 51 137word_value(myvec, TRUE)#> word value #> 1: and 19 #> 2: dad 9 #> 3: cat 24 #> 4: fox 45 #> 5: mom 41 #> 6: add 9 #> 7: dan 19 #> 8: naive 51 #> 9: nondescript 137