From 1e260d85c8f3556ee4efa03c73e927e243724046 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Sun, 6 Oct 2019 22:19:26 +0200 Subject: [PATCH] (v0.7.1.9095) get_column_abx() fix --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/guess_ab_col.R | 11 ++++++++--- docs/404.html | 2 +- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 8 ++++---- docs/reference/index.html | 2 +- 10 files changed, 20 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ab62cd49..76521423 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 0.7.1.9094 +Version: 0.7.1.9095 Date: 2019-10-06 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index f9c4bfa6..ca2829b0 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 0.7.1.9094 +# AMR 0.7.1.9095 Last updated: 06-Oct-2019 ### Breaking diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R index 36d9686c..129f4f91 100755 --- a/R/guess_ab_col.R +++ b/R/guess_ab_col.R @@ -129,9 +129,14 @@ get_column_abx <- function(x, x <- as.character(df_trans$colnames) names(x) <- df_trans$abcode - # remove the ones that do not already have the rsi class (as.rsi) and that have >50% invalid values - x <- sapply(x, function(col = x, df = x_bak) { - ifelse(is.rsi(as.data.frame(df)[, col]) | + # remove the ones that are not a valid AB code, ATC code, name, abbreviation or synonym, + # and do not already have the rsi class (as.rsi) + # and that have >50% invalid values + vectr_antibiotics <- unique(toupper(unlist(AMR::antibiotics[,c("ab", "atc", "name", "abbreviations", "synonyms")]))) + vectr_antibiotics <- vectr_antibiotics[!is.na(vectr_antibiotics) & nchar(vectr_antibiotics) >= 3] + x <- sapply(x, function(col = x, df = x_bak) { + ifelse(toupper(col) %in% vectr_antibiotics | + is.rsi(as.data.frame(df)[, col]) | is.rsi.eligible(as.data.frame(df)[, col], threshold = 0.5), col, NA) diff --git a/docs/404.html b/docs/404.html index e62383e0..f5434742 100644 --- a/docs/404.html +++ b/docs/404.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9094 + 0.7.1.9095 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 75c1a9d9..cada0e5d 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9094 + 0.7.1.9095 diff --git a/docs/articles/index.html b/docs/articles/index.html index f6861e1b..1ef2919f 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9094 + 0.7.1.9095 diff --git a/docs/authors.html b/docs/authors.html index 8d763fbb..9ff80543 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9094 + 0.7.1.9095 diff --git a/docs/index.html b/docs/index.html index 6c689cad..f19e24e8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 0.7.1.9094 + 0.7.1.9095 diff --git a/docs/news/index.html b/docs/news/index.html index 4fadc1e8..27f9a702 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -84,7 +84,7 @@ AMR (for R) - 0.7.1.9094 + 0.7.1.9095 @@ -231,9 +231,9 @@ -
+

-AMR 0.7.1.9094 Unreleased +AMR 0.7.1.9095 Unreleased

Last updated: 06-Oct-2019

@@ -1289,7 +1289,7 @@ Using as.mo(..., allow_uncertain = 3)

Contents