0

I have a dataframe where one of the columns shows the names of some counties in lowercase, sometimes with double spaces. For example:

df$counties
# [1] "san diego county"  "napa   county"  "san   francisco county"

I need to capitalize each of the words and eliminate any multiple spaces. That is, I aim for this result:

df$counties
# [1]"San Diego County"  "Napa County"  "San Francisco County"

Would appreciate any kind advice.

0 Answers0