simpleCap {clinUtils}R Documentation

Capitalize the first letter of a word/sentence.

Description

This implementation is inspired from the help of the toupper function.

Usage

simpleCap(x, onlyFirst = TRUE, rev = FALSE)

Arguments

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 link[tools]{toTitleCase} for a more syntax-friendly implementation.

rev

Logical, if TRUE (FALSE by default), set first letter to lower case (otherwise upper case)

Value

Character vector with first letter capitalized

Author(s)

author of the 'toupper' function?

See Also

link[tools]{toTitleCase}

Examples

# 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)

[Package clinUtils version 0.1.5 Index]