case-insensitive grep, returning unmatched indices

unigrep(..., ignore.case = TRUE, invert = TRUE)

Arguments

..., ignore.case, invert

parameters sent to base::grep()

Value

vector of non-matching indices

Details

This function is a simple wrapper around base::grep() which runs in case-insensitive mode, and returns unmatched entries. It is mainly used to save keystrokes, but is consistently named alongside vgrep and vigrep, and quite helpful for writing concise code.

See also

Other jam grep functions: grepls(), igrepHas(), igrepl(), igrep(), provigrep(), unvigrep(), vgrep(), vigrep()

Examples

V <- paste0(LETTERS[1:5], LETTERS[4:8]);
unigrep("D", V);
#> [1] 2 3 5
igrep("D", V);
#> [1] 1 4