it NA values from v and only keep unique values
  v &lt;- unique(na.omit(v))
  
  #for each entry in v, split it around blank spaces. Note that this
  #function returns a list with one entry per entry in v
  vSplit &lt;- strsplit(v, split = &quot; &quot;)
  
  #We then transform all entries of v to be lower case:
  vSplitAllLower &lt;- sapply(vSplit, tolower)
  
  #We define a helper function that converts a lower case character
  #string into having a capitalized first letter
  foo &lt;- function(x) {
    