nscrabble: Count the Scrabble letter values of text

View source: R/nscrabble.R

nscrabbleR Documentation

Count the Scrabble letter values of text

Description

Tally the Scrabble letter values of text given a user-supplied function, such as the sum (default) or mean of the character values.

Usage

nscrabble(x, FUN = sum)

Arguments

x

a character vector

FUN

function to be applied to the character values in the text; default is sum, but could also be mean or a user-supplied function. Missing values are automatically removed.

Value

a (named) integer vector of Scrabble letter values, computed using FUN, corresponding to the input text(s)

Note

Character values are only defined for non-accented Latin a-z, A-Z letters. Lower-casing is unnecessary.

We would be happy to add more languages to this extremely useful function if you send us the values for your language!

Author(s)

Kenneth Benoit

Examples

nscrabble(c("muzjiks", "excellency"))
nscrabble(quanteda::data_corpus_inaugural[1:5], mean)

quanteda.textstats documentation built on Sept. 11, 2024, 6:39 p.m.