The goal of DOPE is to provide a structured vocabulary and tools to look up details on drugs tracked by the DEA. The data structure is:
You can install the released version of DOPE from CRAN with:
You can look up details on a drug with the
lookup() function. It will check brand, generic and street names.
The lookup funciton supports vectorized lookups:
library(DOPE) lookup("cheese", "pizza", "with", "a", "soda")
If your only care about the category and/or class and/or if you serach returns many matches you can use the compress_lookup() function to drop columns and then remove duplicate rorws.
lookup("cheese", "pizza", "with", "a", "soda") %>% compress_lookup(compressCategory = FALSE, compressClass = TRUE, compressSynonym = TRUE)