This function capitalizes words for use in titles
capwords(
s,
strict = FALSE,
AP = TRUE,
onlyfirst = FALSE,
preserveMixed = FALSE,
sep = " "
)character string to be processed
Logical, remove all additional capitalization.
Logical, apply the Associated Press (AP) rules for prepositions and conjunctions that should not be capitalized in titles.
Logical, only capitalize the first word.
Logical, preserve the capitalization mixed-case words containing an upper-case letter after a lower-case letter.
Character string, word separator
A character scalar containing the capitalized words.
This function separates the provided character string into separate words
using sep as the word separator. If firstonly==TRUE, it then
capitalizes the first letter the first word, otherwise (the default), it
capitalizes the first letter of every word. If AP==TRUE, it then
un-capitalizes words in the Associated Press's (AP) list of prepositions and
conjunctions should not be capitalized in titles. Next, it capitalizes the
first word. It then re-joins the words using the specified separator.
If preserveMixed==TRUE, words with an upper-case letter appearing
after a lower-case letter will not be changed (e.g. "iDevice").
Fogarty, Mignon. Capitalizing Titles: "Which words should you capitalize? Grammar Girl's Quick and Dirty Tips for Better Writing. 9 Jun. 2011. Quick and Dirty Tips Website." Accessed 22 April 2016 https://www.quickanddirtytips.com/articles/capitalizing-titles/
chartr, taxize_capwords,
capwords
capwords("a function to capitalize words in a title")
#> [1] "A Function to Capitalize Words in a Title"
capwords("a function to capitalize words in a title", AP = FALSE)
#> [1] "A Function To Capitalize Words In A Title"
capwords("testing the iProduct for defects")
#> [1] "Testing the IProduct for Defects"
capwords("testing the iProduct for defects", strict = TRUE)
#> [1] "Testing the Iproduct for Defects"
capwords("testing the iProduct for defects", onlyfirst = TRUE)
#> [1] "Testing the iProduct for defects"
capwords("testing the iProduct for defects", preserveMixed = TRUE)
#> [1] "Testing the iProduct for Defects"
capwords("title_using_underscores_as_separators", sep = "_")
#> [1] "Title_Using_Underscores_As_Separators"