sift: Filter a character vector

Description Usage Arguments

View source: R/sift.R

Description

sift filters the list to elements matching the pattern. sieve filters them out.

Usage

1
2
3
4
sift(x, pattern, value = TRUE, perl = TRUE, ignore.case = TRUE,
  on.names = FALSE, invert = FALSE, ...)

sieve(..., invert = TRUE)

Arguments

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.

pattern

character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Coerced by as.character to a character string if possible. If a character vector of length 2 or more is supplied, the first element is used with a warning. Missing values are allowed except for regexpr and gregexpr.

value

if FALSE, a vector containing the (integer) indices of the matches determined by grep is returned, and if TRUE, a vector containing the matching elements themselves is returned.

perl

logical. Should Perl-compatible regexps be used?

ignore.case

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

on.names

Perform filtering on the names of the vector instead.

invert

logical. If TRUE return indices or values for elements that do not match.

...

Passed on


halpo/short documentation built on July 18, 2019, 12:06 a.m.