contains: Test a Character Vector for Occurences of a Pattern

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Test a character vector for occurences of a pattern.

Usage

1
2
contains(pattern, text, ...)
x %contains% y

Arguments

pattern

regular expression

text

character vector

...

extra arguments to regexpr

x

vector

y

pattern to seek in x

Details

Each element of text is tested for pattern, and returns TRUE if pattern matches. The binary operator version implements a more natural syntax.

Value

logical vector as long as text

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
contains(
  'glu',
  c(
    'glucose',
    'glucuronidase',
    'glucogen',
    'fibrogen'
  )
)
letters %contains% 'a'

metrumrg documentation built on May 2, 2019, 5:55 p.m.