o: Only keeps the macthing part of a regular expression

Description Usage Arguments Value Author(s) Examples

Description

The operator %o~% is used to retain the only the part of the txt that matches the regular expression.

Usage

1
txt %o~% pattern

Arguments

txt

Character vector

pattern

Regular expression

Value

In case where parts of the regular expression are surrounded by brackets, the operator returns a matrix with as many lines as the length of txt and as many columns as chunks of regular expressions.

Author(s)

Romain Francois francoisromain@free.fr

Examples

1
2
x <- c("foobar","barfooooooooooooobar")
x %o~% "fo+"

operators documentation built on May 2, 2019, 2:47 p.m.