Cap: Options for word capitalization

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Options for word capitalization

Usage

1
Cap(string, words = c("all", "first"))

Arguments

string

string of words to capitalize

words

whether to capitalize all words (title case; default) or only the first. first DOES NOT preserve capitalization.

Value

string of equal length to string with capitalization applied

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Title case
Cap("put me in title case please")

# First word only
Cap("only the first word this time.", "first")

# Existing capitalization is NOT preserved
Cap("Since Oklahoma is not the first word, it will not be capitalized.", "first")

# Vectorization is accommodated
Cap(c("title case please", "and me too"))

# Handles missing values
Cap(c("title case please", NA_character_, "and me too"))

adamdsmith/itistools documentation built on Oct. 13, 2019, 11:13 a.m.