#' Map medications
#' Last updated: 2020-06-21
#'
#' @param drug_name A string
#' @param medications_file A string
#' @param remove_vaccines A binary value
#' @return A tibble \code{medications}
#' @export
map_medications <- function(drug_name, medications_file, remove_vaccines = TRUE) {
medications <- read_csv(medications_file, col_types=cols())
names(medications) <- tolower(names(medications))
medications <- inner_join(
medications,
rxcui2in,
by = 'rxcui'
)
#remove vaccines, because there are many false-positive correlations
if (remove_vaccines == TRUE) {
medications <- medications %>%
filter(!(str_detect(rxcui_ingr_name, "vaccine")))
}
#remove columns that do not add information
medications <- medications %>%
select(person_id, date, rxcui_ingr)
return(medications)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.