Learn R Programming

textTools (version 0.1.0)

rm_regexp_match: Delete rows in a text.table where the record has a certain pattern indicated by a regular expression

Description

Delete rows in a text.table where the record has a certain pattern indicated by a regular expression

Usage

rm_regexp_match(x, text, pattern)

Arguments

x

A text.table created by as.text.table().

text

A string, the name of the column in x used to determine deletion of rows based on the regular expression.

pattern

A regular expression, gets passed to grepl().

Value

A text.table, with rows having a certain pattern indicated by a regular expression deleted.

Examples

Run this code
# NOT RUN {
rm_regexp_match(
as.text.table(
  x = as.data.table(
    list(
      col1 = c(
        "a",
        "b"
      ),
      col2 = c(
        tolower("The dog is nice because it picked up the newspaper."),
        tolower("The dog is extremely nice because it does the dishes.")
      )
    )
  ),
  text = "col2",
  split = " "
),
text = "col2",
pattern = "do"
)
# }

Run the code above in your browser using DataLab