replace_with: Cleans some patterns in a text by replacing them.

View source: R/replace_with.R

replace_withR Documentation

Cleans some patterns in a text by replacing them.

Description

Cleans some patterns in a text by replacing them.

Usage

replace_with(text, patterns_to_strings = NULL, from = NULL, to = NULL)

Arguments

text

the character vector to clean.

from

the patterns to replace (passed as a vector)

to

the patterns to replace (passed as a vector)

patterns_to_nothing

the patterns to replace and string replacements (passed as a table with columns "from" and "to")

Value

the same text with patterns replaced by strings

Examples

replace_with(c("This is an apple and this is a banana.",
               "Here is a banana and an apple"),
             from=c("apple","banana"),
             to=c("orange","kiwi"))

lvaudor/textoteR documentation built on April 5, 2025, 3:03 a.m.