Regular expression in R to remove the part of a string after the last space

Viewed 1528

I would like to have a gsub expression in R to remove everything in a string that occurs after the last space. E.g. string="Da Silva UF" should return me "Da Silva". Any thoughts?

2 Answers
Related