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
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 class and/or category 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(compressClass = FALSE, compressCategory = TRUE, compressSynonym = TRUE)