1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-12 21:41:55 +02:00

(v1.2.0.9005) data set fix

This commit is contained in:
2020-06-09 16:31:44 +02:00
parent 8b692ecfcf
commit 352508889c
14 changed files with 373 additions and 364 deletions

View File

@ -592,10 +592,14 @@ antibiotics <- antibiotics %>% dplyr::arrange(name)
# make all abbreviations and synonyms lower case, unique and alphabetically sorted ----
for (i in 1:nrow(antibiotics)) {
abb <- sort(unique(tolower(antibiotics[i, "abbreviations"][[1]])))
syn <- sort(unique(tolower(antibiotics[i, "synonyms"][[1]])))
abb <- as.character(sort(unique(tolower(antibiotics[i, "abbreviations"][[1]]))))
syn <- as.character(sort(unique(tolower(antibiotics[i, "synonyms"][[1]]))))
antibiotics[i, "abbreviations"][[1]] <- ifelse(length(abb[!abb == ""]) == 0, list(""), list(abb))
antibiotics[i, "synonyms"][[1]] <- ifelse(length(syn[!syn == ""]) == 0, list(""), list(syn))
if ("loinc" %in% colnames(antibiotics)) {
loinc <- as.character(sort(unique(tolower(antibiotics[i, "loinc"][[1]]))))
antibiotics[i, "loinc"][[1]] <- ifelse(length(syn[!syn == ""]) == 0, list(""), list(loinc))
}
}
# REFER TO data-raw/loinc.R FOR ADDING LOINC CODES