Let's say that I have a two-word string and I want to capitalize both of them.
name <- c("zip code", "state", "final count")
The Hmisc package has a function capitalize which capitalized the first word, but I'm not sure how to get the second word capitalized. The help page for capitalize doesn't suggest that it can perform that task.
library(Hmisc)
capitalize(name)
# [1] "Zip code" "State" "Final count"
I want to get:
c("Zip Code", "State", "Final Count")
What about three-word strings:
name2 <- c("I like pizza")