capName | R Documentation |
Capitalize the first letter of people's (last) names.
capName(x)
x |
the character string or vector to be capitalized. |
The function works for simple names and compound names that are separated by a space or by the character '-'. It also works for names that are entirely capitalized.
This function was conceived to edit people's last names. So, the function only works for up to two names and it works only partially for names containing initials.
For strings with more than two names, the function str_to_title()
from
package stringr
can be used instead.
the character string equal to x
with the first letter
capitalized.
Renato A. F. de Lima
## Not run: # Simple names capName("gentry") capName("HATSCHBACH") capName(c("gentry", "HATSCHBACH")) # Names with generational suffixes capName("leitao filho") # Compound last names capName("saint-hilaire") # Other name formats capName("o'brien") capName("john o'brien") capName("MacDonald") capName("john MacDonald") # Full (>2) names (does not work properly) capName("hermogenes leitao filho") capName("auguste saint-hilaire") capName("a.h. gentry") capName("AH gentry") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.