This help topic is for R version 1.1. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/chartr.html
chartr {base}R Documentation

Character Translation

Description

Translate characters in character vectors.

Usage

chartr(old, new, x)
tolower(x)
toupper(x)

Arguments

x

a character vector.

old

a character string specifying the characters to be translated.

new

a character string specifying the translations.

Details

chartr translates each character in x that is specified in old to the corresponding character specified in new. Ranges are supported in the specifications, but character classes and repreated characters are not. If old contains more characters than new, an error is signaled; if it contains fewer characters, the extra characters at the end of new are ignored.

tolower and toupper convert upper-case characters in a character vector to lower-case, or vice versa. Non-alphabetic characters are left unchanged.

Examples

x <- "MiXeD cAsE 123"
chartr("iXs", "why", x)
chartr("a-cX", "D-Fw", x)
tolower(x)
toupper(x)

[Package base version 1.1 ]