From 89a577805f1199e752b07a6e618757f0c563db9d Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Mon, 30 Jan 2023 12:26:48 +0100 Subject: [PATCH] prelim fix for g.test --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- R/g.test.R | 2 +- R/mo.R | 2 +- pkgdown/extra.css | 5 +++++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e3234804..f387dddc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 1.8.2.9103 -Date: 2023-01-24 +Version: 1.8.2.9104 +Date: 2023-01-30 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) data analysis and to work with microbial and antimicrobial properties by diff --git a/NEWS.md b/NEWS.md index c64a1c69..f04ee706 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.8.2.9103 +# AMR 1.8.2.9104 *(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)* diff --git a/R/g.test.R b/R/g.test.R index cde0c6e5..21deef6a 100755 --- a/R/g.test.R +++ b/R/g.test.R @@ -179,7 +179,7 @@ g.test <- function(x, V <- outer(sr, sc, v, n) dimnames(E) <- dimnames(x) - STATISTIC <- 2 * sum(x * log(x / E)) # sum((abs(x - E) - YATES)^2/E) for chisq.test + STATISTIC <- 2 * sum(x * log(x / E), na.rm = TRUE) # sum((abs(x - E) - YATES)^2/E) for chisq.test PARAMETER <- (nr - 1L) * (nc - 1L) PVAL <- pchisq(STATISTIC, PARAMETER, lower.tail = FALSE) } else { diff --git a/R/mo.R b/R/mo.R index 2a9b8e4e..7d7de8c7 100755 --- a/R/mo.R +++ b/R/mo.R @@ -210,7 +210,7 @@ as.mo <- function(x, # From known codes ---- out[is.na(out) & toupper(x) %in% AMR::microorganisms.codes$code] <- AMR::microorganisms.codes$mo[match(toupper(x)[is.na(out) & toupper(x) %in% AMR::microorganisms.codes$code], AMR::microorganisms.codes$code)] # From SNOMED ---- - if (any(is.na(out) & !is.na(x)) && any(is.na(out) & x %in% unlist(microorganisms$snomed), na.rm = TRUE)) { + if (any(is.na(out) & !is.na(x)) && any(is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed), na.rm = TRUE)) { # found this extremely fast gem here: https://stackoverflow.com/a/11002456/4575331 out[is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed)] <- AMR_env$MO_lookup$mo[rep(seq_along(AMR_env$MO_lookup$snomed), vapply(FUN.VALUE = double(1), AMR_env$MO_lookup$snomed, length))[match(x[is.na(out) & x %in% unlist(AMR_env$MO_lookup$snomed)], unlist(AMR_env$MO_lookup$snomed))]] } diff --git a/pkgdown/extra.css b/pkgdown/extra.css index eb2fc57d..0995fd15 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -49,6 +49,11 @@ content: 'Maintainers'; } +/* marked words for after using the search box */ +mark, .mark { + background: rgba(17, 143, 118, 0.25) !important; +} + /* SYNTAX */ /* These are simple changes for the syntax highlighting */