rat_cap_words: Capitalization of words

View source: R/rat-cap-words.R

rat_cap_wordsR Documentation

Capitalization of words

Description

Capitalize the first letters of words in a string. Can either use sentence case (i.e., only the first word capitalized; all = FALSE) or title case (i.e., all words capitalized; all = TRUE).

Usage

rat_cap_words(x, all = FALSE)

Arguments

x

A character string

all

Logical. If TRUE, the first letter of every word is capitalized. If FALSE (the default), only the first word is capitalized.

Value

A character string with the specified capitalization.

Examples

name <- c("zip code", "state", "final count")
vapply(name, rat_cap_words, character(1))
vapply(name, rat_cap_words, character(1), all = TRUE)

ratlas documentation built on April 4, 2025, 12:22 a.m.