WildcardGlobbingVector: Selection of elements by wildcard/globbing

View source: R/PatternMatching.R

WildcardGlobbingVectorR Documentation

Selection of elements by wildcard/globbing

Description

Selection of elements by wildcard/globbing

Usage

WildcardGlobbingVector(x, wg, negSign = "-", invert = "!")

Arguments

x

Character vector

wg

Character vector with wildcard/globbing

negSign

Character representing selection to be removed

invert

Character to invert each single selection.

Value

vector with selected elements of x

Author(s)

Øyvind Langsrud

Examples

data(precip)
x <- names(precip)

# Select the cities starting with B, C and Sa.
WildcardGlobbingVector(x, c("B*", "C*", "Sa*"))

# Remove from the selection cities with o and t in position 2 and 4, respectively.
WildcardGlobbingVector(x, c("B*", "C*", "Sa*", "-?o*", "-???t*"))

# Add to the selection cities not having six or more letters.
WildcardGlobbingVector(x, c("B*", "C*", "Sa*", "-?o*", "-???t*", "!??????*"))

SSBtools documentation built on July 9, 2023, 6:16 p.m.