View source: R/miscellaneous.R
simpleCap | R Documentation |
This implementation is inspired from the help of the toupper
function.
simpleCap(x, onlyFirst = TRUE, rev = FALSE)
x |
Character vector to capitalize |
onlyFirst |
Logical, if TRUE (by default)
capitalize the first letter of the first word only.
Otherwise, capitalize the first letters of all words of the sentence.
See also |
rev |
Logical, if TRUE (FALSE by default), set first letter to lower case (otherwise upper case) |
Character vector with first letter capitalized
author of the 'toupper' function?
link[tools]{toTitleCase}
# capitalize only the first word of the sentence
simpleCap(x = "this is the caption of my figure.")
# capitalize all words
simpleCap(x = "this is the caption of my figure.", onlyFirst = FALSE)
# opposite: set the first letter of the first word to lower case
simpleCap(x = "This is the caption of my figure.", rev = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.