This function takes a character vector with regular expressions, a numeric vector with numeric indices, or a logical vector that is either as long as the source or has length 1; and then always returns a logical vector of the same length as the source.

get_source_filter(
  source,
  filter,
  ignore.case = TRUE,
  invert = FALSE,
  perl = TRUE,
  ...
)

Arguments

source

The source to produce the filter for.

filter

THe filtering criterion: a character vector with regular expressions, a numeric vector with numeric indices, or a logical vector that is either as long as the source or has length 1.

ignore.case

Whether to apply the regular expression case sensitively or not (see base::grepl()).

invert

Whether to invert the result or not (i.e. whether the filter specifies what you want to select (invert=FALSE) or what you don't want to select (invert=TRUE)).

perl

Whether the regular expression (if filter is a character vector) is a perl regular expression or not (see base::grepl()).

...

Any additional arguments are passed on to base::grepl().

Value

A logical vector of the same length as the source.