VbetterGrepl: Vector Better grepl

Description Usage Arguments Value Examples

Description

This function behaves similarly to betterGrepl, except that it accepts a vector of patterns

Usage

1
VbetterGrepl(pattern, x, ignore.case = T, fixed = T)

Arguments

pattern

character vector containing regular expressions (or character strings for fixed = TRUE) to be matched in the given character vector x. Coerced by as.character to a character string if possible.

x

a character vector where matches are sought, or an object which can be coerced by as.character to a character vector. Long vectors are supported.

ignore.case

logical. if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.

fixed

logical. If TRUE, patterns are strings to be matched as is. Overrides all conflicting arguments.

Value

Logical matrix with one row for each element of x and one column for each element of pattern. The entries indicate whether a math was found between the relevant pattern and character string.

Examples

1
2
3
4
5
6
x = c("Alpha", "Beta", "Bet", NA_character_, "B")
patterns = c("a", NA, "b", "c", "e")
VbetterGrepl(pattern = patterns, x = x)
VbetterGrepl(pattern = patterns, x = x, ignore.case = F)
VbetterGrepl(pattern = patterns, x = x, fixed = F)
VbetterGrepl(pattern = patterns, x = x, ignore.case = F, fixed = F)

debarros/dbTools documentation built on Sept. 18, 2020, 10:51 a.m.