From b5d2a0840127940859c25b79d9eee680b9b66b58 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Tue, 3 Sep 2019 09:47:39 +0200 Subject: [PATCH] (v0.7.1.9071) p_symbol() --- DESCRIPTION | 4 +- NAMESPACE | 1 + NEWS.md | 5 +- R/deprecated.R | 7 + R/{p.symbol.R => p_symbol.R} | 38 +-- docs/LICENSE-text.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 2 +- docs/news/index.html | 11 +- docs/reference/AMR-deprecated.html | 8 +- docs/reference/index.html | 8 +- docs/reference/p_symbol.html | 308 ++++++++++++++++++ docs/sitemap.xml | 2 +- man/AMR-deprecated.Rd | 3 + man/{p.symbol.Rd => p_symbol.Rd} | 8 +- tests/testthat/test-deprecated.R | 3 + .../{test-p.symbol.R => test-p_symbol.R} | 4 +- 18 files changed, 363 insertions(+), 55 deletions(-) rename R/{p.symbol.R => p_symbol.R} (73%) create mode 100644 docs/reference/p_symbol.html rename man/{p.symbol.Rd => p_symbol.Rd} (88%) rename tests/testthat/{test-p.symbol.R => test-p_symbol.R} (94%) diff --git a/DESCRIPTION b/DESCRIPTION index c44161f3..e5420975 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR -Version: 0.7.1.9070 -Date: 2019-09-02 +Version: 0.7.1.9071 +Date: 2019-09-03 Title: Antimicrobial Resistance Analysis Authors@R: c( person(role = c("aut", "cre"), diff --git a/NAMESPACE b/NAMESPACE index 2be34a53..5d8cef10 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -163,6 +163,7 @@ export(mo_year) export(mrgn) export(n_rsi) export(p.symbol) +export(p_symbol) export(portion_I) export(portion_IR) export(portion_R) diff --git a/NEWS.md b/NEWS.md index 375f3054..51260642 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 0.7.1.9070 -Last updated: 02-Sep-2019 +# AMR 0.7.1.9071 +Last updated: 03-Sep-2019 ### Breaking * Determination of first isolates now **excludes** all 'unknown' microorganisms at default, i.e. microbial code `"UNKNOWN"`. They can be included with the new parameter `include_unknown`: @@ -98,6 +98,7 @@ * Improved `filter_ab_class()` to be more reliable and to support 5th generation cephalosporins * Function `availability()` now uses `portion_R()` instead of `portion_IR()`, to comply with EUCAST insights * Functions `age()` and `age_groups()` now have a `na.rm` parameter to remove empty values +* Renamed function `p.symbol()` to `p_symbol()` (the former is now deprecated and will be removed in a future version) #### Other * Added Prof Dr Casper Albers as doctoral advisor and Dr Bart Meijer, Dr Dennis Souverein and Annick Lenglet as contributors diff --git a/R/deprecated.R b/R/deprecated.R index 7f75e9e5..8a2f34de 100755 --- a/R/deprecated.R +++ b/R/deprecated.R @@ -31,3 +31,10 @@ as.atc <- function(x) { .Deprecated("ab_atc", package = "AMR") AMR::ab_atc(x) } + +#' @rdname AMR-deprecated +#' @export +p.symbol <- function(...) { + .Deprecated("p_symbol", package = "AMR") + AMR::p_symbol(...) +} diff --git a/R/p.symbol.R b/R/p_symbol.R similarity index 73% rename from R/p.symbol.R rename to R/p_symbol.R index ffd4c8a2..79110bf5 100755 --- a/R/p.symbol.R +++ b/R/p_symbol.R @@ -27,34 +27,16 @@ #' @return Text #' @inheritSection AMR Read more on our website! #' @export -p.symbol <- function(p, emptychar = " ") { - setting.bak <- options()$scipen - options(scipen = 999) - s <- vector(mode = "character", length = length(p)) - for (i in 1:length(p)) { - if (is.na(p[i])) { - s[i] <- NA_character_ - next - } - if (p[i] > 1) { - s[i] <- NA_character_ - next - } else { - p_test <- p[i] - } +p_symbol <- function(p, emptychar = " ") { - if (p_test > 0.1) { - s[i] <- emptychar - } else if (p_test > 0.05) { - s[i] <- '.' - } else if (p_test > 0.01) { - s[i] <- '*' - } else if (p_test > 0.001) { - s[i] <- '**' - } else if (p_test >= 0) { - s[i] <- '***' - } - } - options(scipen = setting.bak) + p <- as.double(p) + s <- rep(NA_character_, length(p)) + + s[p <= 1] <- emptychar + s[p <= 0.100] <- "." + s[p <= 0.050] <- "*" + s[p <= 0.010] <- "**" + s[p <= 0.001] <- "***" + s } diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index e9ad1f32..2ba7fb61 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9070 + 0.7.1.9071 diff --git a/docs/articles/index.html b/docs/articles/index.html index 1152cf27..0579eeae 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9070 + 0.7.1.9071 diff --git a/docs/authors.html b/docs/authors.html index 68e409ca..7ae2bb88 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9070 + 0.7.1.9071 diff --git a/docs/index.html b/docs/index.html index cd8a60b0..5376e2af 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,7 +42,7 @@ AMR (for R) - 0.7.1.9070 + 0.7.1.9071 diff --git a/docs/news/index.html b/docs/news/index.html index 48ad3e9b..f74cb984 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -78,7 +78,7 @@ AMR (for R) - 0.7.1.9070 + 0.7.1.9071 @@ -225,11 +225,11 @@ -
+

-AMR 0.7.1.9070 Unreleased +AMR 0.7.1.9071 Unreleased

-

Last updated: 02-Sep-2019

+

Last updated: 03-Sep-2019

Breaking

@@ -341,6 +341,7 @@ Since this is a major change, usage of the old also_single_tested w
  • Improved filter_ab_class() to be more reliable and to support 5th generation cephalosporins
  • Function availability() now uses portion_R() instead of portion_IR(), to comply with EUCAST insights
  • Functions age() and age_groups() now have a na.rm parameter to remove empty values
  • +
  • Renamed function p.symbol() to p_symbol() (the former is now deprecated and will be removed in a future version)
  • @@ -1260,7 +1261,7 @@ Using as.mo(..., allow_uncertain = 3)

    Contents

    @@ -234,7 +234,9 @@
    -
    as.atc(x)
    +
    as.atc(x)
    +
    +p.symbol(...)

    Read more on our website!

    @@ -255,7 +257,7 @@