Browse Source

(v1.3.0) small fixes

new-mo-algorithm
parent
commit
c8edcb7439
  1. 14
      NEWS.md
  2. 2
      R/ab_property.R
  3. 2
      data-raw/antibiotics.txt
  4. 4
      data-raw/reproduction_of_antibiotics.R
  5. BIN
      data/antibiotics.rda
  6. 77
      docs/news/index.html
  7. 2
      docs/pkgdown.yml
  8. 2
      docs/reference/ab_property.html
  9. 2
      man/ab_property.Rd
  10. 3
      tests/testthat/test-ab.R
  11. 4
      tests/testthat/test-ab_property.R
  12. 2
      tests/testthat/test-count.R
  13. 3
      tests/testthat/test-pca.R
  14. 3
      tests/testthat/test-proportion.R

14
NEWS.md

@ -46,6 +46,8 @@ @@ -46,6 +46,8 @@
* Any progress bar will now only show in interactive mode (i.e. not in R Markdown)
* Speed improvement for `mdro()` and `filter_ab_class()`
* New option `arrows_textangled` for `ggplot_pca()` to indicate whether the text at the end of the arrows should be angled (defaults to `TRUE`, as it was in previous versions)
* Added parenteral DDD to benzylpenicillin
* Fixed a bug where `as.mic()` could not handle dots without a leading zero (like `"<=.25`)
### Other
* Moved primary location of this project from GitLab to [GitHub](https://github.com/msberends/AMR), giving us native support for automated syntax checking without being dependent on external services such as AppVeyor and Travis CI.
@ -132,7 +134,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag @@ -132,7 +134,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag
### New
* Support for the newest [EUCAST Clinical Breakpoint Tables v.10.0](http://www.eucast.org/clinical_breakpoints/), valid from 1 January 2020. This affects translation of MIC and disk zones using `as.rsi()` and inferred resistance and susceptibility using `eucast_rules()`.
* The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: <https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt>. This **allows for machine reading these guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file [can be found here](https://gitlab.com/msberends/AMR/blob/master/data-raw/read_EUCAST.R).
* The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: <https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt>. This **allows for machine reading these guidelines**, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file [can be found here](https://github.com/msberends/AMR/blob/master/data-raw/read_EUCAST.R).
* Support for LOINC and SNOMED codes
* Support for LOINC codes in the `antibiotics` data set. Use `ab_loinc()` to retrieve LOINC codes, or use a LOINC code for input in any `ab_*` function:
```r
@ -449,9 +451,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag @@ -449,9 +451,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag
* All references to antibiotics in our package now use EARS-Net codes, like `AMX` for amoxicillin
* Functions `atc_certe`, `ab_umcg` and `atc_trivial_nl` have been removed
* All `atc_*` functions are superceded by `ab_*` functions
* All output will be translated by using an included translation file which [can be viewed here](https://gitlab.com/msberends/AMR/blob/master/data-raw/translations.tsv).
Please [create an issue in one of our repositories](https://gitlab.com/msberends/AMR/issues/new?issue[title]=Translation%20suggestion) if you want additions in this file.
* All output will be translated by using an included translation file which [can be viewed here](https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv)
* Improvements to plotting AMR results with `ggplot_rsi()`:
* New parameter `colours` to set the bar colours
* New parameters `title`, `subtitle`, `caption`, `x.title` and `y.title` to set titles and axis descriptions
@ -475,9 +475,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag @@ -475,9 +475,7 @@ This software is now out of beta and considered stable. Nonetheless, this packag
freq(age) %>%
boxplot()
```
* Removed all hardcoded EUCAST rules and replaced them with a new reference file which [can be viewed here](https://gitlab.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv).
Please [create an issue in one of our repositories](https://gitlab.com/msberends/AMR/issues/new?issue[title]=EUCAST%20edit) if you want changes in this file.
* Removed all hardcoded EUCAST rules and replaced them with a new reference file which [can be viewed here](https://github.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv)
* Added ceftazidim intrinsic resistance to *Streptococci*
* Changed default settings for `age_groups()`, to let groups of fives and tens end with 100+ instead of 120+
* Fix for `freq()` for when all values are `NA`
@ -694,7 +692,7 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git @@ -694,7 +692,7 @@ We've got a new website: [https://msberends.gitlab.io/AMR](https://msberends.git
# AMR 0.5.0
#### New
* Repository moved to GitLab: https://gitlab.com/msberends/AMR
* Repository moved to GitLab
* Function `count_all` to get all available isolates (that like all `portion_*` and `count_*` functions also supports `summarise` and `group_by`), the old `n_rsi` is now an alias of `count_all`
* Function `get_locale` to determine language for language-dependent output for some `mo_*` functions. This is now the default value for their `language` parameter, by which the system language will be used at default.
* Data sets `microorganismsDT`, `microorganisms.prevDT`, `microorganisms.unprevDT` and `microorganisms.oldDT` to improve the speed of `as.mo`. They are for reference only, since they are primarily for internal use of `as.mo`.

2
R/ab_property.R

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
#'
#' Use these functions to return a specific property of an antibiotic from the [antibiotics] data set. All input values will be evaluated internally with [as.ab()].
#' @inheritSection lifecycle Stable lifecycle
#' @param x any (vector of) text that can be coerced to a valid microorganism code with [as.ab()]
#' @param x any (vector of) text that can be coerced to a valid antibiotic code with [as.ab()]
#' @param tolower logical to indicate whether the first character of every output should be transformed to a lower case character. This will lead to e.g. "polymyxin B" and not "polymyxin b".
#' @param property one of the column names of one of the [antibiotics] data set
#' @param language language of the returned text, defaults to system language (see [get_locale()]) and can also be set with `getOption("AMR_locale")`. Use `language = NULL` or `language = ""` to prevent translation.

2
data-raw/antibiotics.txt

@ -329,7 +329,7 @@ @@ -329,7 +329,7 @@
"PEF" "J01MA03" 51081 "Pefloxacin" "Quinolones" "Quinolone antibacterials" "Fluoroquinolones" "c(\"\", \"pefl\")" "c(\"abactal\", \"labocton\", \"pefloxacin\", \"pefloxacine\", \"pefloxacino\", \"pefloxacinum\", \"perfloxacin\", \"silver pefloxacin\")" 0.8 "g" 0.8 "g" "3906-5"
"PNM" "J01CE06" 10250769 "Penamecillin" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "" "c(\"hydroxymethyl\", \"penamecilina\", \"penamecillin\", \"penamecillina\", \"penamecilline\", \"penamecillinum\")" 1.05 "g" "character(0)"
"PEN" "J01CE01" 5904 "Penicillin G" "Beta-lactams/penicillins" "Combinations of antibacterials" "Combinations of antibacterials" "c(\"p\", \"pen\", \"peni\", \"pv\")" "c(\"abbocillin\", \"ayercillin\", \"bencilpenicilina\", \"benzopenicillin\", \"benzyl penicillin\", \"benzylpenicillin\", \"benzylpenicillin g\", \"benzylpenicilline\", \"benzylpenicillinum\", \"bicillin\", \"cillora\", \"cilloral\", \"cilopen\", \"compocillin g\", \"cosmopen\", \"dropcillin\", \"free penicillin g\", \"free penicillin ii\", \"galofak\", \"gelacillin\", \"liquacillin\", \"megacillin\", \"pencillin g\", \"penicillin\", \"penicilling\", \"pentids\", \"permapen\", \"pfizerpen\", \"pfizerpen g\", \"pharmacillin\", \"pradupen\", \"specilline g\", \"ursopen\"
)" "3913-1"
)" 3.6 "g" "3913-1"
"PNV" "J01CE01" 6869 "Penicillin V" "Beta-lactams/penicillins" "Beta-lactam antibacterials, penicillins" "Beta-lactamase sensitive penicillins" "c(\"bepe\", \"p\", \"pen\", \"pv\")" "c(\"acipen v\", \"apocillin\", \"apopen\", \"beromycin\", \"calcipen\", \"compocillin v\", \"crystapen v\", \"distaquaine v\", \"eskacillian v\", \"eskacillin v\", \"fenacilin\", \"fenospen\", \"meropenin\", \"oracillin\", \"oratren\", \"penicillin v\", \"phenocillin\", \"phenomycilline\", \"phenopenicillin\", \"robicillin\", \"rocilin\", \"stabicillin\", \"vebecillin\", \"veetids\", \"vegacillin\")" 3.6 "g" "3914-9"
"PNO" "Penicillin/novobiocin" "Beta-lactams/penicillins" "" "" ""
"PSU" "Penicillin/sulbactam" "Beta-lactams/penicillins" "" "" ""

4
data-raw/reproduction_of_antibiotics.R

@ -541,6 +541,10 @@ old_sym <- old_sym[!old_sym %in% c("Cotrimoxazole", "Bactrimel")] @@ -541,6 +541,10 @@ old_sym <- old_sym[!old_sym %in% c("Cotrimoxazole", "Bactrimel")]
antibiotics[which(antibiotics$ab == "SMX"), "synonyms"][[1]] <- list(old_sym)
antibiotics[which(antibiotics$ab == "SXT"), "synonyms"][[1]] <- list(sort(unique(c(antibiotics[which(antibiotics$ab == "COL"), "synonyms"][[1]], "Cotrimoxazole", "Bactrimel", "Septra", "Bactrim", "Cotrimazole"))))
# New DDDs
antibiotics[which(antibiotics$ab == "PEN"), "iv_ddd"] <- 3.6
antibiotics[which(antibiotics$ab == "PEN"), "iv_units"] <- "g"
## new ATC codes
# ceftaroline
antibiotics[which(antibiotics$ab == "CPT"), "atc"] <- "J01DI02"

BIN
data/antibiotics.rda

Binary file not shown.

77
docs/news/index.html

@ -298,6 +298,8 @@ @@ -298,6 +298,8 @@
<li><p>Any progress bar will now only show in interactive mode (i.e. not in R Markdown)</p></li>
<li><p>Speed improvement for <code><a href="../reference/mdro.html">mdro()</a></code> and <code><a href="../reference/filter_ab_class.html">filter_ab_class()</a></code></p></li>
<li><p>New option <code>arrows_textangled</code> for <code><a href="../reference/ggplot_pca.html">ggplot_pca()</a></code> to indicate whether the text at the end of the arrows should be angled (defaults to <code>TRUE</code>, as it was in previous versions)</p></li>
<li><p>Added parenteral DDD to benzylpenicillin</p></li>
<li><p>Fixed a bug where <code><a href="../reference/as.mic.html">as.mic()</a></code> could not handle dots without a leading zero (like <code>"&lt;=.25</code>)</p></li>
</ul>
</div>
<div id="other" class="section level3">
@ -447,7 +449,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ @@ -447,7 +449,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<a href="#new-2" class="anchor"></a>New</h3>
<ul>
<li>Support for the newest <a href="http://www.eucast.org/clinical_breakpoints/">EUCAST Clinical Breakpoint Tables v.10.0</a>, valid from 1 January 2020. This affects translation of MIC and disk zones using <code><a href="../reference/as.rsi.html">as.rsi()</a></code> and inferred resistance and susceptibility using <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code>.</li>
<li>The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: <a href="https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt" class="uri">https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt</a>. This <strong>allows for machine reading these guidelines</strong>, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file <a href="https://gitlab.com/msberends/AMR/blob/master/data-raw/read_EUCAST.R">can be found here</a>.</li>
<li>The repository of this package now contains a clean version of the EUCAST and CLSI guidelines from 2011-2020 to translate MIC and disk diffusion values to R/SI: <a href="https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt" class="uri">https://github.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt</a>. This <strong>allows for machine reading these guidelines</strong>, which is almost impossible with the Excel and PDF files distributed by EUCAST and CLSI. This file used to process the EUCAST Clinical Breakpoints Excel file <a href="https://github.com/msberends/AMR/blob/master/data-raw/read_EUCAST.R">can be found here</a>.</li>
<li>Support for LOINC and SNOMED codes
<ul>
<li>
@ -865,43 +867,39 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ @@ -865,43 +867,39 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<h4 class="hasAnchor">
<a href="#changed-6" class="anchor"></a>Changed</h4>
<ul>
<li><p>Fixed a critical bug in <code><a href="../reference/first_isolate.html">first_isolate()</a></code> where missing species would lead to incorrect FALSEs. This bug was not present in AMR v0.5.0, but was in v0.6.0 and v0.6.1.</p></li>
<li><p>Fixed a bug in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> where antibiotics from WHONET software would not be recognised</p></li>
<li>
<p>Completely reworked the <code>antibiotics</code> data set:</p>
<li>Fixed a critical bug in <code><a href="../reference/first_isolate.html">first_isolate()</a></code> where missing species would lead to incorrect FALSEs. This bug was not present in AMR v0.5.0, but was in v0.6.0 and v0.6.1.</li>
<li>Fixed a bug in <code><a href="../reference/eucast_rules.html">eucast_rules()</a></code> where antibiotics from WHONET software would not be recognised</li>
<li>Completely reworked the <code>antibiotics</code> data set:
<ul>
<li>
<p>All entries now have 3 different identifiers:</p>
<li>All entries now have 3 different identifiers:
<ul>
<li>Column <code>ab</code> contains a human readable EARS-Net code, used by ECDC and WHO/WHONET - this is the primary identifier used in this package</li>
<li>Column <code>atc</code> contains the ATC code, used by WHO/WHOCC</li>
<li>Column <code>cid</code> contains the CID code (Compound ID), used by PubChem</li>
</ul>
</li>
<li><p>Based on the Compound ID, almost 5,000 official brand names have been added from many different countries</p></li>
<li><p>All references to antibiotics in our package now use EARS-Net codes, like <code>AMX</code> for amoxicillin</p></li>
<li><p>Functions <code>atc_certe</code>, <code>ab_umcg</code> and <code>atc_trivial_nl</code> have been removed</p></li>
<li><p>All <code>atc_*</code> functions are superceded by <code>ab_*</code> functions</p></li>
<li>
<p>All output will be translated by using an included translation file which <a href="https://gitlab.com/msberends/AMR/blob/master/data-raw/translations.tsv">can be viewed here</a>.</p>
<p>Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=Translation%20suggestion">create an issue in one of our repositories</a> if you want additions in this file.</p>
<li>Based on the Compound ID, almost 5,000 official brand names have been added from many different countries</li>
<li>All references to antibiotics in our package now use EARS-Net codes, like <code>AMX</code> for amoxicillin</li>
<li>Functions <code>atc_certe</code>, <code>ab_umcg</code> and <code>atc_trivial_nl</code> have been removed</li>
<li>All <code>atc_*</code> functions are superceded by <code>ab_*</code> functions</li>
<li>All output will be translated by using an included translation file which <a href="https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv">can be viewed here</a>
</li>
</ul>
</li>
<li>
<p>Improvements to plotting AMR results with <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code>:</p>
<li>Improvements to plotting AMR results with <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code>:
<ul>
<li>New parameter <code>colours</code> to set the bar colours</li>
<li>New parameters <code>title</code>, <code>subtitle</code>, <code>caption</code>, <code>x.title</code> and <code>y.title</code> to set titles and axis descriptions</li>
</ul>
</li>
<li><p>Improved intelligence of looking up antibiotic columns in a data set using <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code></p></li>
<li><p>Added ~5,000 more old taxonomic names to the <code>microorganisms.old</code> data set, which leads to better results finding when using the <code><a href="../reference/as.mo.html">as.mo()</a></code> function</p></li>
<li><p>This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like <code><a href="../reference/AMR-deprecated.html">portion_df()</a></code> and <code><a href="../reference/count.html">count_df()</a></code> this means that their new parameter <code>combine_SI</code> is TRUE at default. Our plotting function <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> also reflects this change since it uses <code><a href="../reference/count.html">count_df()</a></code> internally.</p></li>
<li><p>The <code><a href="../reference/age.html">age()</a></code> function gained a new parameter <code>exact</code> to determine ages with decimals</p></li>
<li><p>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code></p></li>
<li>
<p>Frequency tables (<code>freq()</code>):</p>
<li>Improved intelligence of looking up antibiotic columns in a data set using <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
</li>
<li>Added ~5,000 more old taxonomic names to the <code>microorganisms.old</code> data set, which leads to better results finding when using the <code><a href="../reference/as.mo.html">as.mo()</a></code> function</li>
<li>This package now honours the new EUCAST insight (2019) that S and I are but classified as susceptible, where I is defined as ‘increased exposure’ and not ‘intermediate’ anymore. For functions like <code><a href="../reference/AMR-deprecated.html">portion_df()</a></code> and <code><a href="../reference/count.html">count_df()</a></code> this means that their new parameter <code>combine_SI</code> is TRUE at default. Our plotting function <code><a href="../reference/ggplot_rsi.html">ggplot_rsi()</a></code> also reflects this change since it uses <code><a href="../reference/count.html">count_df()</a></code> internally.</li>
<li>The <code><a href="../reference/age.html">age()</a></code> function gained a new parameter <code>exact</code> to determine ages with decimals</li>
<li>Removed deprecated functions <code>guess_mo()</code>, <code>guess_atc()</code>, <code>EUCAST_rules()</code>, <code>interpretive_reading()</code>, <code><a href="../reference/as.rsi.html">rsi()</a></code>
</li>
<li>Frequency tables (<code>freq()</code>):
<ul>
<li><p>speed improvement for microbial IDs</p></li>
<li><p>fixed factor level names for R Markdown</p></li>
@ -919,20 +917,22 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ @@ -919,20 +917,22 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
</li>
</ul>
</li>
<li>
<p>Removed all hardcoded EUCAST rules and replaced them with a new reference file which <a href="https://gitlab.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv">can be viewed here</a>.</p>
<p>Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=EUCAST%20edit">create an issue in one of our repositories</a> if you want changes in this file.</p>
</li>
<li><p>Added ceftazidim intrinsic resistance to <em>Streptococci</em></p></li>
<li><p>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+</p></li>
<li><p>Fix for <code>freq()</code> for when all values are <code>NA</code></p></li>
<li><p>Fix for <code><a href="../reference/first_isolate.html">first_isolate()</a></code> for when dates are missing</p></li>
<li><p>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code></p></li>
<li><p>Function <code><a href="../reference/as.mo.html">as.mo()</a></code> now gently interprets any number of whitespace characters (like tabs) as one space</p></li>
<li><p>Function <code><a href="../reference/as.mo.html">as.mo()</a></code> now returns <code>UNKNOWN</code> for <code>"con"</code> (WHONET ID of ‘contamination’) and returns <code>NA</code> for <code>"xxx"</code>(WHONET ID of ‘no growth’)</p></li>
<li><p>Small algorithm fix for <code><a href="../reference/as.mo.html">as.mo()</a></code></p></li>
<li><p>Removed viruses from data set <code>microorganisms.codes</code> and cleaned it up</p></li>
<li><p>Fix for <code><a href="../reference/mo_property.html">mo_shortname()</a></code> where species would not be determined correctly</p></li>
<li>Removed all hardcoded EUCAST rules and replaced them with a new reference file which <a href="https://github.com/msberends/AMR/blob/master/data-raw/eucast_rules.tsv">can be viewed here</a>
</li>
<li>Added ceftazidim intrinsic resistance to <em>Streptococci</em>
</li>
<li>Changed default settings for <code><a href="../reference/age_groups.html">age_groups()</a></code>, to let groups of fives and tens end with 100+ instead of 120+</li>
<li>Fix for <code>freq()</code> for when all values are <code>NA</code>
</li>
<li>Fix for <code><a href="../reference/first_isolate.html">first_isolate()</a></code> for when dates are missing</li>
<li>Improved speed of <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code>
</li>
<li>Function <code><a href="../reference/as.mo.html">as.mo()</a></code> now gently interprets any number of whitespace characters (like tabs) as one space</li>
<li>Function <code><a href="../reference/as.mo.html">as.mo()</a></code> now returns <code>UNKNOWN</code> for <code>"con"</code> (WHONET ID of ‘contamination’) and returns <code>NA</code> for <code>"xxx"</code>(WHONET ID of ‘no growth’)</li>
<li>Small algorithm fix for <code><a href="../reference/as.mo.html">as.mo()</a></code>
</li>
<li>Removed viruses from data set <code>microorganisms.codes</code> and cleaned it up</li>
<li>Fix for <code><a href="../reference/mo_property.html">mo_shortname()</a></code> where species would not be determined correctly</li>
</ul>
</div>
<div id="other-7" class="section level4">
@ -1198,8 +1198,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/ @@ -1198,8 +1198,7 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
<h4 class="hasAnchor">
<a href="#new-8" class="anchor"></a>New</h4>
<ul>
<li>Repository moved to GitLab: <a href="https://gitlab.com/msberends/AMR" class="uri">https://gitlab.com/msberends/AMR</a>
</li>
<li>Repository moved to GitLab</li>
<li>Function <code>count_all</code> to get all available isolates (that like all <code>portion_*</code> and <code>count_*</code> functions also supports <code>summarise</code> and <code>group_by</code>), the old <code>n_rsi</code> is now an alias of <code>count_all</code>
</li>
<li>Function <code>get_locale</code> to determine language for language-dependent output for some <code>mo_*</code> functions. This is now the default value for their <code>language</code> parameter, by which the system language will be used at default.</li>

2
docs/pkgdown.yml

@ -10,7 +10,7 @@ articles: @@ -10,7 +10,7 @@ articles:
WHONET: WHONET.html
benchmarks: benchmarks.html
resistance_predict: resistance_predict.html
last_built: 2020-07-30T10:26Z
last_built: 2020-07-30T13:15Z
urls:
reference: https://msberends.github.io/AMR/reference
article: https://msberends.github.io/AMR/articles

2
docs/reference/ab_property.html

@ -266,7 +266,7 @@ @@ -266,7 +266,7 @@
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>x</th>
<td><p>any (vector of) text that can be coerced to a valid microorganism code with <code><a href='as.ab.html'>as.ab()</a></code></p></td>
<td><p>any (vector of) text that can be coerced to a valid antibiotic code with <code><a href='as.ab.html'>as.ab()</a></code></p></td>
</tr>
<tr>
<th>language</th>

2
man/ab_property.Rd

@ -44,7 +44,7 @@ ab_url(x, open = FALSE, ...) @@ -44,7 +44,7 @@ ab_url(x, open = FALSE, ...)
ab_property(x, property = "name", language = get_locale(), ...)
}
\arguments{
\item{x}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.ab]{as.ab()}}}
\item{x}{any (vector of) text that can be coerced to a valid antibiotic code with \code{\link[=as.ab]{as.ab()}}}
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}

3
tests/testthat/test-ab.R

@ -22,6 +22,9 @@ @@ -22,6 +22,9 @@
context("ab.R")
test_that("as.ab works", {
skip_on_cran()
expect_equal(as.character(as.ab(c("J01FA01",
"J 01 FA 01",
"Erythromycin",

4
tests/testthat/test-ab_property.R

@ -22,7 +22,9 @@ @@ -22,7 +22,9 @@
context("ab_property.R")
test_that("ab_property works", {
skip_on_cran()
expect_identical(ab_name("AMX"), "Amoxicillin")
expect_identical(as.character(ab_atc("AMX")), "J01CA04")
expect_identical(ab_cid("AMX"), as.integer(33613))

2
tests/testthat/test-count.R

@ -23,6 +23,8 @@ context("count.R") @@ -23,6 +23,8 @@ context("count.R")
test_that("counts work", {
skip_on_cran()
expect_equal(count_resistant(example_isolates$AMX), count_R(example_isolates$AMX))
expect_equal(count_susceptible(example_isolates$AMX), count_SI(example_isolates$AMX))
expect_equal(count_all(example_isolates$AMX), n_rsi(example_isolates$AMX))

3
tests/testthat/test-pca.R

@ -22,6 +22,9 @@ @@ -22,6 +22,9 @@
context("pca.R")
test_that("PCA works", {
skip_on_cran()
resistance_data <- structure(list(order = c("Bacillales", "Enterobacterales", "Enterobacterales"),
genus = c("Staphylococcus", "Escherichia", "Klebsiella"),
AMC = c(0.00425, 0.13062, 0.10344),

3
tests/testthat/test-proportion.R

@ -22,6 +22,9 @@ @@ -22,6 +22,9 @@
context("proportion.R")
test_that("proportions works", {
skip_on_cran()
expect_equal(proportion_R(example_isolates$AMX), resistance(example_isolates$AMX))
expect_equal(proportion_SI(example_isolates$AMX), susceptibility(example_isolates$AMX))

Loading…
Cancel
Save