Learn R Programming

lares (version 4.10.6)

scrabble_score: Scrabble: Word Scores

Description

Get score for any word or list of words. You may set manually depending on the rules and languages you are playing with. Check the examples for Spanish and English values when I played Words With Friends.

Usage

scrabble_score(words, scores)

Arguments

words

Character vector. Words to score

scores

Dataframe. Must contain two columns: "tiles" with every letter of the alphabet and "scores" for each letter's score.

Value

data.frame with word, scores, and length values for each word.

See Also

Other Scrabble: scrabble_dictionary(), scrabble_points(), scrabble_words()

Examples

Run this code
# NOT RUN {
# For Spanish words (default)
es_scores <- scrabble_points("es")
# Custom scores for each letter
cu_scores <- data.frame(
  tiles = tolower(LETTERS),
  scores = c(1,1,1,1,1,1,1,5,1,1,5,2,4,2,1,4,10,1,1,1,2,5,4,8,3,10))

# Score values for each set of rules 
words <- c("Bernardo", "Whiskey", "R is great")
scrabble_score(words, es_scores)
scrabble_score(words, cu_scores)
# }

Run the code above in your browser using DataLab