grep, returning values

vgrep(..., value = TRUE, ignore.case = FALSE)

Arguments

..., value, ignore.case

parameters sent to base::grep()

Value

vector of matching values

Details

This function is a simple wrapper around base::grep() which returns matching values. It is particularly helpful when grabbing values from a vector, but where the case (uppercase or lowercase) is known.

See also

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

Examples

V <- paste0(LETTERS[1:5], LETTERS[4:8]);
vgrep("D", V);
#> [1] "AD" "DG"
vgrep("d", V);
#> character(0)
vigrep("d", V);
#> [1] "AD" "DG"