bind: Add Left/Right Character(s) Boundaries

View source: R/bind.R

bindR Documentation

Add Left/Right Character(s) Boundaries

Description

This convenience function wraps left and right boundaries of each element of a character vector. The default is to use "\b" for left and right boundaries.

Usage

bind(
  ...,
  left = "\\b",
  right = left,
  dictionary = getOption("regex.library")
)

Arguments

left

A single length character vector to use as the left bound.

right

A single length character vector to use as the right bound.

dictionary

A dictionary of canned regular expressions to search within.

...

Regular expressions to add grouping parenthesis to a named expression from the default regular expression dictionary prefixed with single at (@) (e.g., "@rm_hash") or a regular expression from regex_supplement dictionary prefixed with an at (@) (e.g., "@time_12_hours").

Value

Returns a character vector.

See Also

paste0

Examples

bind(LETTERS, "[", "]")

## More useful default parameters/usage
x <- c("Computer is fun. Not too fun.", "No it's not, it's dumb.", 
    "What should we do?", "You liar, it stinks!", "I am telling the truth!", 
    "How can we be certain?", "There is no way.", "I distrust you.", 
    "What are you talking about?", "Shall we move on?  Good then.", 
    "I'm hungry.  Let's eat.  You already?")

Fry25 <- c("the", "of", "and", "a", "to", "in", "is", "you", "that", "it", 
    "he", "was", "for", "on", "are", "as", "with", "his", "they", 
    "I", "at", "be", "this", "have", "from")

gsub(pastex(list(bind(Fry25))), "[[ELIM]]", x)

qdapRegex documentation built on Oct. 17, 2023, 5:06 p.m.