abbr: Abbreviations

View source: R/utils2.R

abbrR Documentation

Abbreviations

Description

Extract abbreviations from strings.

Usage

abbr(x, pattern = "[A-Z]", n = 1L, include = "[a-z]+")

Arguments

x

a vector of strings to abbreviate

pattern, n

the pattern and number of occurrences to use

include

an optional pattern to match additional strings surrounded by word boundaries; any non character will omit

Examples

x <- c('United States of America', 'the Red, the White, and the Blue')
abbr(x)
abbr(x, include = NA)
abbr(x, include = 'and')
abbr(x, '[A-Z][A-z]', include = NA)


raredd/rawr documentation built on March 4, 2024, 1:36 a.m.