Skip to content

Instantly share code, notes, and snippets.

@MattSandy
Last active April 7, 2017 05:26
Show Gist options
  • Save MattSandy/35a563405d3375bc71e092568abec8af to your computer and use it in GitHub Desktop.
Save MattSandy/35a563405d3375bc71e092568abec8af to your computer and use it in GitHub Desktop.
Returns the vector of each word found before the end of a sentence.
termination_words <- toupper(as.character(sapply(unlist(strsplit(text,'\\.')),function(x) {
words <- unlist(strsplit(x,' '))
return(words[length(words)])
})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment