I\'m trying to do something but can\'t remember/find the answer. I have a list of city names from the Census Bureau and they put the city\'s type on the end which is messin
Here's a regexp that does what you need:
sub(df1$city, pattern = " [[:alpha:]]*$", replacement = "")
[1] "Middletown" "Sunny Valley" "Hillside"
That's replacing a substring that starts with a space, then contains only letters until the end of the string, with an empty string.