From 9179e98e12d7da5cf54d588eafa57def5b7d2ab0 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Sat, 11 Mar 2023 17:13:19 +0100 Subject: [PATCH] patient ID in first isolate --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/first_isolate.R | 4 ++-- R/proportion.R | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 38b76c80..b5c9f931 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.8.2.9150 +Version: 1.8.2.9151 Date: 2023-03-11 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index bc4cbd68..0b3dec7b 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.8.2.9150 +# AMR 1.8.2.9151 *(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)* diff --git a/R/first_isolate.R b/R/first_isolate.R index 20392cab..b04a613a 100755 --- a/R/first_isolate.R +++ b/R/first_isolate.R @@ -350,7 +350,7 @@ first_isolate <- function(x = NULL, x$newvar_mo <- as.mo(x[, col_mo, drop = TRUE]) x$newvar_genus_species <- paste(mo_genus(x$newvar_mo), mo_species(x$newvar_mo)) x$newvar_date <- x[, col_date, drop = TRUE] - x$newvar_patient_id <- x[, col_patient_id, drop = TRUE] + x$newvar_patient_id <- as.character(x[, col_patient_id, drop = TRUE]) if (is.null(col_testcode)) { testcodes_exclude <- NULL @@ -378,7 +378,7 @@ first_isolate <- function(x = NULL, } } if (!is.null(col_keyantimicrobials)) { - x$newvar_key_ab <- x[, col_keyantimicrobials, drop = TRUE] + x$newvar_key_ab <- as.character(x[, col_keyantimicrobials, drop = TRUE]) } if (is.null(testcodes_exclude)) { diff --git a/R/proportion.R b/R/proportion.R index 179bb859..3598322e 100755 --- a/R/proportion.R +++ b/R/proportion.R @@ -303,13 +303,14 @@ sir_confidence_interval <- function(..., } if (isTRUE(as_percent)) { out <- percentage(out, digits = 1) - } else { - out <- round(out, digits = 3) } if (!isFALSE(collapse) && length(out) > 1) { + if (is.numeric(out)) { + out <- round(out, digits = 3) + } out <- paste(out, collapse = ifelse(isTRUE(collapse), "-", collapse)) } - + if (n < minimum) { warning_("Introducing NA: ", ifelse(n == 0, "no", paste("only", n)),