mergeTerms: Transform, merge, separate, or delete terms from a corpus

Description Usage Arguments Details Value Examples

Description

Manipulate the content of text that will be analyzed. Merge like terms into a single term, replace names found in text, and remove content deemed irrelevant.

Usage

1
mergeTerms(data.td, term, term.replacement)

Arguments

data.td

A tidy dataset

term

A user identified term

term.replacement

A user specified term to replace the original term found in the text

Details

Supplied a search term and a replacement term, this function seeks to identify each instance of the search term within the corpus and replace it with the replacement term. Should the user elect to delete a term, instead of replacing it, the replacement term should be identified as "" within the function. **Warning: Once a term is deleted from the corpus it can not be replaced. To return the term to the analysis, the corpus must be rebuilt to its previous state.

Value

Permanently alters the corpus by replacing all instances of term with term.replacement

Examples

1
2
3
Articles <- mergeTerms(Articles,"Affordable Care Act","ACA")
Articles <- mergeTerms(Articles,"White House", "White_House")
Articles <- mergeTerms(Articles, "Fox News", "")

JSmith146/CoRpEx documentation built on May 17, 2019, 10:11 p.m.