Learn R Programming

lava (version 1.8.0)

Grep: Finds elements in vector or column-names in data.frame/matrix

Description

Pattern matching in a vector or column names of a data.frame or matrix.

Usage

Grep(x, pattern, subset = TRUE, ignore.case = TRUE, ...)

Value

A data.frame with 2 columns with the indices in the first and the matching names in the second.

Arguments

x

vector, matrix or data.frame.

pattern

regular expression to search for

subset

If TRUE returns subset of data.frame/matrix otherwise just the matching column names

ignore.case

Default ignore case

...

Additional arguments to 'grep'

Author

Klaus K. Holst

See Also

grep, and agrep for approximate string matching,

Examples

Run this code
data(iris)
head(Grep(iris,"(len)|(sp)"))

Run the code above in your browser using DataLab