Given a Drug Lookup table as returned by the function lookup, collapse rows from unwanted columns

compress_lookup(
  lookupTable,
  compressOriginalWord = FALSE,
  compressClass = FALSE,
  compressCategory = FALSE,
  compressSynonym = TRUE
)

Arguments

lookupTable

A lookup table with category data.frame having three columns: drug class, drug category, and drug street name. These tables are returned by the function lookup.

compressOriginalWord

Should the search word(s) be collapsed? Defaults to FALSE.

compressClass

Should the drug class be collapsed? Defaults to FALSE.

compressCategory

Should the drug category be collapsed? Defaults to FALSE.

compressSynonym

Should the drug synonym / street name be collapsed? Defaults to TRUE.

Value

A compressed lookup table, with unwanted columns removed.

Examples

longExampleTable <- lookup("dope", "methamphetamine") compress_lookup(longExampleTable)
#> original_word class category #> 1 dope heroin heroin #> 2 dope cannabis marijuana #> 3 methamphetamine stimulant methamphetamine
compress_lookup(longExampleTable, compressCategory = TRUE)
#> original_word class #> 1 dope heroin #> 2 dope cannabis #> 3 methamphetamine stimulant