cap {cwhmisc}R Documentation

Change case of strings

Description

capply apply function to elements in character vector (utility function) cap and capitalize change to capital letters. lower and lowerize change to lower case letters. CapLeading Capitalizes the first character of each element of a character vector

Usage

capply(str,ff,...)
cap(char)
capitalize(str)
lower(char)
lowerize(str)
CapLeading(str)

Arguments

str a character vector.
ff a function.
char a single letter.
... a function .

Value

The same as the argument.

Note

capply has been reverse engineered from the help page on strsplit: strReverse <- function(x) sapply(lapply(strsplit(x, NULL), rev), paste, collapse="") can be written as capply(x, rev)

Author(s)

Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
http://www.wsl.ch/personal_homepages/hoffmann/index_EN

Examples

# capitalize shows the use of capply
cap("f")    # "F"
capitalize(c("TruE","faLSe"))  # "TRUE"  "FALSE"
lower("R")  # "r"
lowerize("TruE")  # "true"
CapLeading(c("all you ","need"))     # "All you " "Need"
capply(c("abc", "elephant"), rev)  # "cba"    "tnahpele"

[Package cwhmisc version 2.0.1 Index]