Created
October 25, 2017 03:20
-
-
Save ajatoledo/7599489333ced8435e196658ac59e3c7 to your computer and use it in GitHub Desktop.
This is a simply function that can be called to format a vector of first name, middle name, surname vectors. Note that this does NOT account for any surnames that required lowercase first letters for proper formatting.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proper_name_formatting <- function(x) { | |
y <- strsplit(x, " ")[[1]] | |
paste(toupper(substring(y, 1,1)), substring(y, 2), | |
sep="", collapse=" ") | |
} | |
# below is an example for how to use the function | |
# usages is sapply(x, proper_name_formatting) | |
# hello_world <- c("hello world) | |
# sapply(hello_world, proper_name_formatting) -> Hello World |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment