mgrepl: Multiple grepl.

Description Usage Arguments Value Examples

View source: R/my_functions.r

Description

Takes in a list of regex patterns and returns true if any pattern matches.

Usage

1

Arguments

x

A vector of strings to search.

pattern

A vector of regex patterns.

Value

A vector of the same length as x, TRUE if any pattern matches.

Examples

1
2
3
4
5
6
7
8
9
x <- fastReadLines("http://textfiles.com/ufo/ufobooks.ufo", newlinechar="\r\n", 1e5)
head(x[mgrepl(c("ALIENS", "UFO"), x)])

[1] "                         UFOLOGY BOOKS (REVISION 2.1 343 books)"
[2] "     H. S. Stewart on the  subject of UFO's. The list is alphabetic"
[3] "     Tom Mickus's most excellent board UFONET I.  (416-237-1204)"
[4] "     Bill Adler               *   LETTERS TO THE AIR FORCE ON UFOS  1967"
[5] "     Gordon W. Allen              OVERLORDS OLYMPIANS AND THE UFO   1974"
[6] "     Robert B. Beard              FLYING SAUCERS, UFO'S AND EXTRA"

traversc/trqwe documentation built on Dec. 4, 2020, 4:21 a.m.