Learn R Programming

ratlas (version 0.1.1)

rat_cap_words: 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)

Value

A character string with the specified capitalization.

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.

Examples

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

Run the code above in your browser using DataLab