Skip to contents

This function identifies variations of a primary term within a corpus of articles.

Usage

get_term_vars(articles, primary_term, text_col = "abstract")

Arguments

articles

A data frame containing article data with text columns

primary_term

The primary term to find variations of

text_col

Name of the column containing the text to search

Value

A character vector of unique term variations, sorted by length

Examples

# Create example articles
articles <- data.frame(
  abstract = c(
    "Migraine headaches are debilitating",
    "Migraines affect quality of life",
    "Migraine disorders require treatment"
  )
)

# Get term variations
variations <- get_term_vars(articles, "migrain")
print(variations)
#> [1] "Migraine"  "Migraines"