grepr: 'grep' and return hits

View source: R/grepr.R

greprR Documentation

'grep' and return hits

Description

This is a wrapper for grep to return not only the indexes of the hits (optional), but the hits themselves. (This is mainly a helper function for find_var but can at times be useful.)

Usage

grepr(pattern, x, index = FALSE, ...)

Arguments

pattern

pattern to look for

x

character string to inspect

index

logical; whether to also return indexes of hits (defaul FALSE)

...

arguments to be passed to grep

See Also

grep, grepl

Examples

grepr(pattern="a", x=names(datasets::mtcars))

renlund/datma documentation built on June 2, 2025, 5:12 a.m.