fork download
  1. library(stringr)
  2. dirty_string <- c('finance analyst i')
  3. str_replace(dirty_string, "\\s+\\w+$", "")
  4.  
Success #stdin #stdout 0.36s 42768KB
stdin
Standard input is empty
stdout
[1] "finance analyst"