abbrev: Create vector of Initials

Description Usage Arguments Details Value Examples

Description

abbrev returns a character vector of each words first capital letters for each element of x.

Usage

1
abbrev(x, exceptions = NULL)

Arguments

x

vector of strings to be abbreviated.

exceptions

list with two names vectors: old, a vector abbreviations to be replaced and new, a vector of replacment values.

Details

This function returns a same-length character vector that abbrevs an initial character vector, x. Abbreviation returns the first capital letter of any words in each element of x. Users may additionally pass abbrev and option list of exceptions that overides the default abbreviations. The list of exceptions requires a vector of "old" values to be replaced by "new" values

Value

a character vector of length(x).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x<-c("KIPP Ascend Middle School", "KIPP Ascend Primary School",
     "KIPP Create College Prep",
     "KIPP Bloom College Prep" ,
     "KIPP One Academy")

abbrev(x)

altnames<-list(old=c("KAPS", "KBCP", "KOA"),
                 new=c("KAP", "Bloom", "One"))

abbrev(x, excpetions=altnames)

almartin82/MAP-visuals documentation built on May 10, 2019, 9:24 a.m.