I am doing some data cleaning on a series of individual names in a data frame column. I want to remove non-alpha characters at the end of each name.
countries <- c("Senegal1345769", "Canada&", "Austria12", "Spain-", "Russia#$")
In the case above, I'd want to turn countries into:
[1] "Senegal" "Canada" "Austria" "Spain" "Russia"
I could use gsub() with character specific patterns (e.g., pattern = ",$") but I'm not quite sure how to do this for strings with multiple, varying trailing non-alphas (e.g., "Senegal1345769").
What kind of pattern would be used to address this issue?