upFirst: Change First Letters to Upper Case

Description Usage Arguments References Examples

View source: R/upFirst.s

Description

Changes the first letter of each word in a string to upper case, keeping selected words in lower case. Words containing at least 2 capital letters are kept as-is.

Usage

1
upFirst(txt, lower = FALSE, alllower = FALSE)

Arguments

txt

a character vector

lower

set to TRUE to make only the very first letter of the string upper case, and to keep words with at least 2 capital letters in their original form

alllower

set to TRUE to make every word start with lower case unless it has at least 2 caps

References

https://en.wikipedia.org/wiki/Letter_case#Headings_and_publication_titles

Examples

1
upFirst(c('this and that','that is Beyond question'))

Example output

Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

[1] "This and That"           "That Is Beyond Question"

Hmisc documentation built on Oct. 7, 2021, 9:16 a.m.