Finding Numeric Values of Strings using strsplit()

December 19, 2012

(This article was first published on is.R(), and kindly contributed to R-bloggers)


Given a random list of words, can you find which has the lowest or highest numerical value when we apply a basic number:letter cipher? 

A while back I asked David how he would solve this problem:

Today’s post shows how to take a vector of words, parse them into each of the individual letters comprising the word, and calculate the sum of the value of the word using A=1, B=2, …, Z=26.


P.S. The code can be modified to find the answer (162) to:

To leave a comment for the author, please follow the link and comment on his blog: is.R(). offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.