case function

Upper/Lower/Title Case

Upper/Lower/Title Case

TC - Capitalize titles according to traditional capitalization rules.

TC(text.var, lower = NULL, ...) L(text.var, ...) U(text.var, ...)

Arguments

  • text.var: The text variable.
  • lower: A vector of words to retain lower case for (unless first or last word).
  • ``: Other arguments passed to: stri_trans_tolower, stri_trans_toupper, and stri_trans_totitle.

Returns

Returns a character vector with new case (lower, upper, or title).

Details

Case wrapper functions for stringi's stri_trans_tolower, stri_trans_toupper, and stri_trans_totitle. Functions are useful within magrittr style chaining.

Note

TC utilizes additional rules for capitalization beyond stri_trans_totitle that include:

  1. Capitalize the first & last word
  2. Lowercase articles, coordinating conjunctions, & prepositions
  3. Lowercase "to" in an infinitive

Examples

y <- c( "I'm liking it but not too much.", "How much are you into it?", "I'd say it's yet awesome yet." ) L(y) U(y) TC(y)

See Also

stri_trans_tolower, stri_trans_toupper, stri_trans_totitle

  • Maintainer: Tyler Rinker
  • License: GPL-2
  • Last published: 2025-03-24