Merge branch 'premaster' of https://gitlab.com/msberends/AMR into premaster

This commit is contained in:
dr. M.S. (Matthijs) Berends 2019-07-29 23:48:34 +02:00
commit b730920bb3
87 changed files with 879 additions and 3068 deletions

View File

@ -1,6 +1,6 @@
Package: AMR
Version: 0.7.1.9013
Date: 2019-07-11
Version: 0.7.1.9017
Date: 2019-07-29
Title: Antimicrobial Resistance Analysis
Authors@R: c(
person(
@ -45,6 +45,7 @@ Depends:
R (>= 3.1.0)
Imports:
backports,
clean,
crayon (>= 1.3.0),
data.table (>= 1.9.0),
dplyr (>= 0.7.0),
@ -59,7 +60,6 @@ Suggests:
covr (>= 3.0.1),
curl,
readxl,
rmarkdown,
rstudioapi,
rvest (>= 0.3.2),
testthat (>= 1.0.2),

View File

@ -1,7 +1,6 @@
# Generated by roxygen2: do not edit by hand
S3method(as.data.frame,ab)
S3method(as.data.frame,freq)
S3method(as.data.frame,mo)
S3method(as.double,mic)
S3method(as.integer,mic)
@ -10,28 +9,21 @@ S3method(as.rsi,data.frame)
S3method(as.rsi,default)
S3method(as.rsi,disk)
S3method(as.rsi,mic)
S3method(as.vector,freq)
S3method(as_tibble,freq)
S3method(barplot,mic)
S3method(barplot,rsi)
S3method(boxplot,freq)
S3method(diff,freq)
S3method(droplevels,mic)
S3method(droplevels,rsi)
S3method(format,freq)
S3method(hist,freq)
S3method(freq,mo)
S3method(freq,rsi)
S3method(kurtosis,data.frame)
S3method(kurtosis,default)
S3method(kurtosis,matrix)
S3method(plot,freq)
S3method(plot,mic)
S3method(plot,resistance_predict)
S3method(plot,rsi)
S3method(print,ab)
S3method(print,catalogue_of_life_version)
S3method(print,disk)
S3method(print,freq)
S3method(print,frequency_tbl)
S3method(print,mic)
S3method(print,mo)
S3method(print,mo_renamed)
@ -39,7 +31,6 @@ S3method(print,mo_uncertainties)
S3method(print,rsi)
S3method(pull,ab)
S3method(pull,mo)
S3method(select,freq)
S3method(skewness,data.frame)
S3method(skewness,default)
S3method(skewness,matrix)
@ -98,8 +89,6 @@ export(filter_glycopeptides)
export(filter_macrolides)
export(filter_tetracyclines)
export(first_isolate)
export(freq)
export(frequency_tbl)
export(full_join_microorganisms)
export(g.test)
export(geom_rsi)
@ -108,7 +97,6 @@ export(get_mo_source)
export(ggplot_rsi)
export(ggplot_rsi_predict)
export(guess_ab_col)
export(header)
export(inner_join_microorganisms)
export(is.ab)
export(is.disk)
@ -171,35 +159,26 @@ export(semi_join_microorganisms)
export(set_mo_source)
export(skewness)
export(theme_rsi)
export(top_freq)
exportMethods(as.data.frame.ab)
exportMethods(as.data.frame.freq)
exportMethods(as.data.frame.mo)
exportMethods(as.double.mic)
exportMethods(as.integer.mic)
exportMethods(as.numeric.mic)
exportMethods(as.vector.freq)
exportMethods(as_tibble.freq)
exportMethods(barplot.mic)
exportMethods(barplot.rsi)
exportMethods(boxplot.freq)
exportMethods(diff.freq)
exportMethods(droplevels.mic)
exportMethods(droplevels.rsi)
exportMethods(format.freq)
exportMethods(hist.freq)
exportMethods(freq.mo)
exportMethods(freq.rsi)
exportMethods(kurtosis)
exportMethods(kurtosis.data.frame)
exportMethods(kurtosis.default)
exportMethods(kurtosis.matrix)
exportMethods(plot.freq)
exportMethods(plot.mic)
exportMethods(plot.rsi)
exportMethods(print.ab)
exportMethods(print.catalogue_of_life_version)
exportMethods(print.disk)
exportMethods(print.freq)
exportMethods(print.frequency_tbl)
exportMethods(print.mic)
exportMethods(print.mo)
exportMethods(print.mo_renamed)
@ -209,7 +188,6 @@ exportMethods(pull.ab)
exportMethods(pull.mo)
exportMethods(scale_type.ab)
exportMethods(scale_type.mo)
exportMethods(select.freq)
exportMethods(skewness)
exportMethods(skewness.data.frame)
exportMethods(skewness.default)
@ -217,6 +195,8 @@ exportMethods(skewness.matrix)
exportMethods(summary.mic)
exportMethods(summary.mo)
exportMethods(summary.rsi)
importFrom(clean,freq)
importFrom(clean,top_freq)
importFrom(crayon,bgGreen)
importFrom(crayon,bgRed)
importFrom(crayon,bgYellow)
@ -232,7 +212,6 @@ importFrom(crayon,strip_style)
importFrom(crayon,underline)
importFrom(crayon,white)
importFrom(crayon,yellow)
importFrom(data.table,address)
importFrom(data.table,as.data.table)
importFrom(data.table,data.table)
importFrom(data.table,setkey)
@ -241,9 +220,7 @@ importFrom(dplyr,all_vars)
importFrom(dplyr,any_vars)
importFrom(dplyr,arrange)
importFrom(dplyr,arrange_at)
importFrom(dplyr,as_tibble)
importFrom(dplyr,between)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
importFrom(dplyr,case_when)
importFrom(dplyr,desc)
@ -252,7 +229,6 @@ importFrom(dplyr,everything)
importFrom(dplyr,filter)
importFrom(dplyr,filter_all)
importFrom(dplyr,filter_at)
importFrom(dplyr,full_join)
importFrom(dplyr,funs)
importFrom(dplyr,group_by)
importFrom(dplyr,group_by_at)
@ -275,35 +251,24 @@ importFrom(dplyr,slice)
importFrom(dplyr,summarise)
importFrom(dplyr,summarise_if)
importFrom(dplyr,tibble)
importFrom(dplyr,top_n)
importFrom(dplyr,transmute)
importFrom(dplyr,ungroup)
importFrom(dplyr,vars)
importFrom(grDevices,boxplot.stats)
importFrom(graphics,arrows)
importFrom(graphics,axis)
importFrom(graphics,barplot)
importFrom(graphics,boxplot)
importFrom(graphics,hist)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(graphics,points)
importFrom(graphics,text)
importFrom(hms,is.hms)
importFrom(knitr,kable)
importFrom(microbenchmark,microbenchmark)
importFrom(rlang,as_label)
importFrom(rlang,enquos)
importFrom(rlang,eval_tidy)
importFrom(scales,percent)
importFrom(stats,complete.cases)
importFrom(stats,fivenum)
importFrom(stats,glm)
importFrom(stats,lm)
importFrom(stats,mad)
importFrom(stats,pchisq)
importFrom(stats,predict)
importFrom(stats,sd)
importFrom(utils,browseURL)
importFrom(utils,browseVignettes)
importFrom(utils,installed.packages)

View File

@ -1,4 +1,7 @@
# AMR 0.7.1.9013
# AMR 0.7.1.9017
### Breaking
* Function `freq()` has moved to a new package, [`clean`](https://github.com/msberends/clean) ([CRAN link](https://cran.r-project.org/package=clean)). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. We decided to create a new package for data cleaning and checking and it perfectly fits the `freq()` function. The [`clean`](https://github.com/msberends/clean) package is available on CRAN and will be installed automatically when updating the `AMR` package, that now imports it. In a later stage, the `skewness()` and `kurtosis()` functions will be moved to the `clean` package too.
### New
* Additional way to calculate co-resistance, i.e. when using multiple antibiotics as input for `portion_*` functions or `count_*` functions. This can be used to determine the empiric susceptibily of a combination therapy. A new parameter `only_all_tested` (**which defaults to `FALSE`**) replaces the old `also_single_tested` and can be used to select one of the two methods to count isolates and calculate portions. The difference can be seen in this example table (which is also on the `portion` and `count` help pages), where the %SI is being determined:

View File

@ -90,6 +90,7 @@ NULL
#' @export
#' @examples
#' library(dplyr)
#' library(clean)
#' microorganisms %>% freq(kingdom)
#' microorganisms %>% group_by(kingdom) %>% freq(phylum, nmax = NULL)
catalogue_of_life_version <- function() {

View File

@ -70,7 +70,7 @@
#' @keywords isolate isolates first
#' @seealso \code{\link{key_antibiotics}}
#' @export
#' @importFrom dplyr arrange_at lag between row_number filter mutate arrange pull
#' @importFrom dplyr arrange_at lag between row_number filter mutate arrange pull ungroup
#' @importFrom crayon blue bold silver
#' @return Logical vector
#' @source Methodology of this function is based on: \strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition}, 2014, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}.

1268
R/freq.R

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,8 @@
#'
#' plot(mic_data)
#' barplot(mic_data)
#'
#' library(clean)
#' freq(mic_data)
as.mic <- function(x, na.rm = FALSE) {
if (is.mic(x)) {

1
R/mo.R
View File

@ -1412,6 +1412,7 @@ print.mo <- function(x, ...) {
#' @exportMethod summary.mo
#' @importFrom dplyr n_distinct
#' @importFrom clean freq top_freq
#' @export
#' @noRd
summary.mo <- function(object, ...) {

View File

@ -58,7 +58,7 @@
#' @rdname resistance_predict
#' @export
#' @importFrom stats predict glm lm
#' @importFrom dplyr %>% pull mutate mutate_at n group_by_at summarise filter filter_at all_vars n_distinct arrange case_when n_groups transmute
#' @importFrom dplyr %>% pull mutate mutate_at n group_by_at summarise filter filter_at all_vars n_distinct arrange case_when n_groups transmute ungroup
#' @inheritSection AMR Read more on our website!
#' @examples
#' x <- resistance_predict(septic_patients, col_ab = "AMX", year_min = 2010)

View File

@ -50,7 +50,7 @@
#' @return Ordered factor with new class \code{rsi}
#' @keywords rsi
#' @export
#' @importFrom dplyr %>%
#' @importFrom dplyr %>% desc arrange filter
#' @seealso \code{\link{as.mic}}
#' @inheritSection AMR Read more on our website!
#' @examples
@ -73,6 +73,8 @@
#'
#' plot(rsi_data) # for percentages
#' barplot(rsi_data) # for frequencies
#'
#' library(clean)
#' freq(rsi_data) # frequency table with informative header
#'
#' # using dplyr's mutate

Binary file not shown.

View File

@ -62,12 +62,6 @@ navbar:
- text: "Get properties of an antibiotic"
icon: "fa-capsules"
href: "reference/ab_property.html" # reference instead of article
- text: "Create frequency tables"
icon: "fa-sort-amount-down"
href: "articles/freq.html"
# - text: "Use the G-test"
# icon: "fa-clipboard-check"
# href: "reference/g.test.html" # reference instead of article
- text: "Other: benchmarks"
icon: "fa-shipping-fast"
href: "articles/benchmarks.html"
@ -130,13 +124,12 @@ reference:
- title: "Analysing your data"
desc: >
Functions for conducting AMR analysis, like counting isolates, calculating
resistance or susceptibility, creating frequency tables or make plots.
resistance or susceptibility, or make plots.
contents:
- "`availability`"
- "`count`"
- "`portion`"
- "`filter_ab_class`"
- "`freq`"
- "`g.test`"
- "`ggplot_rsi`"
- "`kurtosis`"

Binary file not shown.

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9017</span>
</span>
</div>
@ -156,13 +156,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -118,13 +118,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -192,7 +185,7 @@
<h1>How to apply EUCAST rules</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">10 July 2019</h4>
<h4 class="date">29 July 2019</h4>
<div class="hidden name"><code>EUCAST.Rmd</code></div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -118,13 +118,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -192,7 +185,7 @@
<h1>How to determine multi-drug resistance (MDR)</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">10 July 2019</h4>
<h4 class="date">29 July 2019</h4>
<div class="hidden name"><code>MDR.Rmd</code></div>
@ -235,18 +228,18 @@
<p>The data set looks like this now:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/head">head</a></span>(my_TB_data)</a>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="co"># rifampicin isoniazid gatifloxacin ethambutol pyrazinamide moxifloxacin</span></a>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="co"># 1 R S S R S R</span></a>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="co"># 2 R S R S S S</span></a>
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="co"># 3 R R R R S R</span></a>
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="co"># 4 S S R S R S</span></a>
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="co"># 5 R R S I S S</span></a>
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># 6 S S R R R S</span></a>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="co"># 1 S S S R S S</span></a>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="co"># 2 R S R R I R</span></a>
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="co"># 3 S R R R I R</span></a>
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="co"># 4 S S R I I R</span></a>
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="co"># 5 R S R S S R</span></a>
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># 6 R S R R S R</span></a>
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># kanamycin</span></a>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># 1 S</span></a>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># 1 I</span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># 2 S</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># 3 S</span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># 4 R</span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># 5 R</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># 3 R</span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># 4 S</span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># 5 S</span></a>
<a class="sourceLine" id="cb3-15" data-line-number="15"><span class="co"># 6 S</span></a></code></pre></div>
<p>We can now add the interpretation of MDR-TB to our data set:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">my_TB_data<span class="op">$</span>mdr &lt;-<span class="st"> </span><span class="kw"><a href="../reference/mdro.html">mdr_tb</a></span>(my_TB_data)</a>
@ -257,9 +250,11 @@
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="co"># Author: WHO (World Health Organization)</span></a>
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="co"># Source: https://www.who.int/tb/publications/pmdt_companionhandbook/en/</span></a>
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="co"># </span><span class="al">NOTE</span><span class="co">: Reliability might be improved if these antimicrobial results would be available too: CAP (capreomycin), RIB (rifabutin), RFP (rifapentine)</span></a></code></pre></div>
<p>And review the result with a frequency table:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="../reference/freq.html">freq</a></span>(my_TB_data<span class="op">$</span>mdr)</a></code></pre></div>
<p><strong>Frequency table of <code>mdr</code> from <code>my_TB_data</code> (5,000 x 8)</strong></p>
<p>We also created a package dedicated to data cleaning and checking, called the <code>clean</code> package. It gets automatically installed with the <code>AMR</code> package, so we only have to load it:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(clean)</a></code></pre></div>
<p>It contains the <code><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq()</a></code> function, to create a frequency table:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq</a></span>(my_TB_data<span class="op">$</span>mdr)</a></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: factor &gt; ordered (numeric)<br>
Length: 5,000 (of which NA: 0 = 0.00%)<br>
Levels: 5: Negative &lt; Mono-resistance &lt; Poly-resistance &lt; Multidrug resistance…<br>
@ -277,41 +272,41 @@ Unique: 5</p>
<tr class="odd">
<td align="left">1</td>
<td align="left">Mono-resistance</td>
<td align="right">3,273</td>
<td align="right">65.5%</td>
<td align="right">3,273</td>
<td align="right">65.5%</td>
<td align="right">3225</td>
<td align="right">64.5%</td>
<td align="right">3225</td>
<td align="right">64.5%</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">Negative</td>
<td align="right">687</td>
<td align="right">13.7%</td>
<td align="right">3,960</td>
<td align="right">79.2%</td>
<td align="right">644</td>
<td align="right">12.9%</td>
<td align="right">3869</td>
<td align="right">77.4%</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">Multidrug resistance</td>
<td align="right">569</td>
<td align="right">11.4%</td>
<td align="right">4,529</td>
<td align="right">90.6%</td>
<td align="right">626</td>
<td align="right">12.5%</td>
<td align="right">4495</td>
<td align="right">89.9%</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">Poly-resistance</td>
<td align="right">277</td>
<td align="right">5.5%</td>
<td align="right">4,806</td>
<td align="right">96.1%</td>
<td align="right">288</td>
<td align="right">5.8%</td>
<td align="right">4783</td>
<td align="right">95.7%</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="left">Extensive drug resistance</td>
<td align="right">194</td>
<td align="right">3.9%</td>
<td align="right">5,000</td>
<td align="right">217</td>
<td align="right">4.3%</td>
<td align="right">5000</td>
<td align="right">100.0%</td>
</tr>
</tbody>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -118,13 +118,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -192,7 +185,7 @@
<h1>How to import data from SPSS / SAS / Stata</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">10 July 2019</h4>
<h4 class="date">29 July 2019</h4>
<div class="hidden name"><code>SPSS.Rmd</code></div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -118,13 +118,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -192,7 +185,7 @@
<h1>How to work with WHONET data</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">10 July 2019</h4>
<h4 class="date">29 July 2019</h4>
<div class="hidden name"><code>WHONET.Rmd</code></div>
@ -228,16 +221,20 @@
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span>(<span class="dt">mo =</span> <span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(Organism)) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="st"> </span><span class="co"># transform everything from "AMP_ND10" to "CIP_EE" to the new `rsi` class</span></a>
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="st"> </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/mutate_all.html">mutate_at</a></span>(<span class="kw"><a href="https://dplyr.tidyverse.org/reference/vars.html">vars</a></span>(AMP_ND10<span class="op">:</span>CIP_EE), as.rsi)</a></code></pre></div>
<p>No errors or warnings, so all values are transformed succesfully. Lets check it though, with a couple of frequency tables:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="co"># our newly created `mo` variable</span></a>
<a class="sourceLine" id="cb4-2" data-line-number="2">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(mo, <span class="dt">nmax =</span> <span class="dv">10</span>)</a></code></pre></div>
<p><strong>Frequency table of <code>mo</code> from <code>data</code> (500 x 54)</strong></p>
<p>No errors or warnings, so all values are transformed succesfully.</p>
<p>We created a package dedicated to data cleaning and checking, called the <code>clean</code> package. It gets automatically installed with the <code>AMR</code> package, so we only have to load it:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(clean)</a></code></pre></div>
<p>It contains the <code><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq()</a></code> function, to create frequency tables.</p>
<p>So lets check our data, with a couple of frequency tables:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="co"># our newly created `mo` variable</span></a>
<a class="sourceLine" id="cb5-2" data-line-number="2">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq</a></span>(mo, <span class="dt">nmax =</span> <span class="dv">10</span>)</a></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: mo (character)<br>
Length: 500 (of which NA: 0 = 0.00%)<br>
Unique: 39</p>
<p>Families: 10<br>
Genera: 17<br>
Species: 38</p>
Species: 39</p>
<table class="table">
<thead><tr class="header">
<th align="left"></th>
@ -331,18 +328,16 @@ Species: 38</p>
</tbody>
</table>
<p>(omitted 29 entries, n = 57 [11.4%])</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"></a>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="co"># our transformed antibiotic columns</span></a>
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></a>
<a class="sourceLine" id="cb5-4" data-line-number="4">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(AMC_ND2)</a></code></pre></div>
<p><strong>Frequency table of <code>AMC_ND2</code> from <code>data</code> (500 x 54)</strong></p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1"></a>
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># our transformed antibiotic columns</span></a>
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="co"># amoxicillin/clavulanic acid (J01CR02) as an example</span></a>
<a class="sourceLine" id="cb6-4" data-line-number="4">data <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/clean/topics/freq">freq</a></span>(AMC_ND2)</a></code></pre></div>
<p><strong>Frequency table</strong></p>
<p>Class: factor &gt; ordered &gt; rsi (numeric)<br>
Length: 500 (of which NA: 19 = 3.80%)<br>
Length: 481 (of which NA: 19 = 3.95%)<br>
Levels: 3: S &lt; I &lt; R<br>
Unique: 3</p>
<p>Drug: Amoxicillin/clavulanic acid (AMC, J01CR02)<br>
Group: Beta-lactams/penicillins<br>
%SI: 78.59%</p>
<p>%SI: 78.6%</p>
<table class="table">
<thead><tr class="header">
<th align="left"></th>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -118,13 +118,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -192,7 +185,7 @@
<h1>Benchmarks</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">10 July 2019</h4>
<h4 class="date">29 July 2019</h4>
<div class="hidden name"><code>benchmarks.Rmd</code></div>
@ -217,14 +210,14 @@
<a class="sourceLine" id="cb2-8" data-line-number="8"> <span class="dt">times =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(S.aureus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># as.mo("sau") 8.5 8.7 12.0 8.9 9.4 26 10</span></a>
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># as.mo("stau") 31.0 32.0 42.0 33.0 34.0 120 10</span></a>
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="co"># as.mo("staaur") 8.6 8.7 11.0 9.1 9.2 26 10</span></a>
<a class="sourceLine" id="cb2-15" data-line-number="15"><span class="co"># as.mo("STAAUR") 8.7 9.1 9.3 9.2 9.4 11 10</span></a>
<a class="sourceLine" id="cb2-16" data-line-number="16"><span class="co"># as.mo("S. aureus") 23.0 23.0 30.0 24.0 40.0 46 10</span></a>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="co"># as.mo("S. aureus") 22.0 23.0 27.0 24.0 25.0 41 10</span></a>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># as.mo("Staphylococcus aureus") 3.9 4.0 5.7 4.1 4.4 20 10</span></a></code></pre></div>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="co"># as.mo("sau") 8.3 8.4 15.0 8.9 9.5 57.0 10</span></a>
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="co"># as.mo("stau") 30.0 31.0 42.0 32.0 48.0 110.0 10</span></a>
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="co"># as.mo("staaur") 8.3 8.4 10.0 8.5 8.9 25.0 10</span></a>
<a class="sourceLine" id="cb2-15" data-line-number="15"><span class="co"># as.mo("STAAUR") 8.1 8.4 10.0 8.4 9.1 24.0 10</span></a>
<a class="sourceLine" id="cb2-16" data-line-number="16"><span class="co"># as.mo("S. aureus") 23.0 23.0 29.0 24.0 38.0 45.0 10</span></a>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="co"># as.mo("S. aureus") 22.0 22.0 24.0 23.0 24.0 38.0 10</span></a>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="co"># as.mo("Staphylococcus aureus") 3.8 3.9 4.1 4.1 4.2 4.6 10</span></a></code></pre></div>
<p>In the table above, all measurements are shown in milliseconds (thousands of seconds). A value of 5 milliseconds means it can determine 200 input values per second. It case of 100 milliseconds, this is only 10 input values per second. The second input is the only one that has to be looked up thoroughly. All the others are known codes (the first one is a WHONET code) or common laboratory codes, or common full organism names like the last one. Full organism names are always preferred.</p>
<p>To achieve this speed, the <code>as.mo</code> function also takes into account the prevalence of human pathogenic microorganisms. The downside is of course that less prevalent microorganisms will be determined less fast. See this example for the ID of <em>Thermus islandicus</em> (<code>B_THERMS_ISL</code>), a bug probably never found before in humans:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">T.islandicus &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"theisl"</span>),</a>
@ -236,12 +229,12 @@
<a class="sourceLine" id="cb3-7" data-line-number="7"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(T.islandicus, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb3-8" data-line-number="8"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb3-9" data-line-number="9"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("theisl") 290 310 320 320 320 350 10</span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("THEISL") 290 300 310 310 330 340 10</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("T. islandicus") 140 140 150 150 160 170 10</span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("T. islandicus") 140 140 150 150 170 180 10</span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Thermus islandicus") 50 52 58 54 68 70 10</span></a></code></pre></div>
<p>That takes 10.2 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
<a class="sourceLine" id="cb3-10" data-line-number="10"><span class="co"># as.mo("theisl") 250 260 260 260 270 290 10</span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"><span class="co"># as.mo("THEISL") 250 260 270 260 270 320 10</span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"><span class="co"># as.mo("T. islandicus") 120 120 130 130 140 150 10</span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"><span class="co"># as.mo("T. islandicus") 120 130 140 140 140 140 10</span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"><span class="co"># as.mo("Thermus islandicus") 45 46 55 56 62 67 10</span></a></code></pre></div>
<p>That takes 8.8 times as much time on average. A value of 100 milliseconds means it can only determine ~10 different input values per second. We can conclude that looking up arbitrary codes of less prevalent microorganisms is the worst way to go, in terms of calculation performance. Full names (like <em>Thermus islandicus</em>) are almost fast - these are the most probable input from most data sets.</p>
<p>In the figure below, we compare <em>Escherichia coli</em> (which is very common) with <em>Prevotella brevis</em> (which is moderately common) and with <em>Thermus islandicus</em> (which is very uncommon):</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/par">par</a></span>(<span class="dt">mar =</span> <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="dv">5</span>, <span class="dv">16</span>, <span class="dv">4</span>, <span class="dv">2</span>)) <span class="co"># set more space for left margin text (16)</span></a>
<a class="sourceLine" id="cb4-2" data-line-number="2"></a>
@ -287,8 +280,8 @@
<a class="sourceLine" id="cb5-24" data-line-number="24"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb5-25" data-line-number="25"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb5-26" data-line-number="26"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb5-27" data-line-number="27"><span class="co"># mo_fullname(x) 611 628 643 635 650 714 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.63 seconds (634 ms). You only lose time on your unique input values.</p>
<a class="sourceLine" id="cb5-27" data-line-number="27"><span class="co"># mo_fullname(x) 586 611 623 619 638 671 10</span></a></code></pre></div>
<p>So transforming 500,000 values (!!) of 50 unique values only takes 0.62 seconds (618 ms). You only lose time on your unique input values.</p>
</div>
<div id="precalculated-results" class="section level3">
<h3 class="hasAnchor">
@ -301,10 +294,10 @@
<a class="sourceLine" id="cb6-5" data-line-number="5"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb6-6" data-line-number="6"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb6-7" data-line-number="7"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb6-8" data-line-number="8"><span class="co"># A 6.730 7.030 8.030 7.750 8.72 9.73 10</span></a>
<a class="sourceLine" id="cb6-9" data-line-number="9"><span class="co"># B 22.400 23.000 27.100 23.600 27.10 46.00 10</span></a>
<a class="sourceLine" id="cb6-10" data-line-number="10"><span class="co"># C 0.835 0.877 0.978 0.925 1.12 1.18 10</span></a></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0009 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<a class="sourceLine" id="cb6-8" data-line-number="8"><span class="co"># A 6.350 6.600 7.050 6.870 7.35 8.37 10</span></a>
<a class="sourceLine" id="cb6-9" data-line-number="9"><span class="co"># B 21.300 21.500 25.300 22.200 22.70 48.20 10</span></a>
<a class="sourceLine" id="cb6-10" data-line-number="10"><span class="co"># C 0.624 0.753 0.804 0.783 0.87 1.01 10</span></a></code></pre></div>
<p>So going from <code><a href="../reference/mo_property.html">mo_fullname("Staphylococcus aureus")</a></code> to <code>"Staphylococcus aureus"</code> takes 0.0008 seconds - it doesnt even start calculating <em>if the result would be the same as the expected resulting value</em>. That goes for all helper functions:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">run_it &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="dt">A =</span> <span class="kw"><a href="../reference/mo_property.html">mo_species</a></span>(<span class="st">"aureus"</span>),</a>
<a class="sourceLine" id="cb7-2" data-line-number="2"> <span class="dt">B =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"Staphylococcus"</span>),</a>
<a class="sourceLine" id="cb7-3" data-line-number="3"> <span class="dt">C =</span> <span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Staphylococcus aureus"</span>),</a>
@ -317,14 +310,14 @@
<a class="sourceLine" id="cb7-10" data-line-number="10"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">3</span>)</a>
<a class="sourceLine" id="cb7-11" data-line-number="11"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb7-12" data-line-number="12"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb7-13" data-line-number="13"><span class="co"># A 0.468 0.470 0.533 0.489 0.595 0.690 10</span></a>
<a class="sourceLine" id="cb7-14" data-line-number="14"><span class="co"># B 0.504 0.513 0.555 0.520 0.571 0.711 10</span></a>
<a class="sourceLine" id="cb7-15" data-line-number="15"><span class="co"># C 0.629 0.687 0.864 0.855 1.050 1.130 10</span></a>
<a class="sourceLine" id="cb7-16" data-line-number="16"><span class="co"># D 0.505 0.515 0.575 0.530 0.649 0.767 10</span></a>
<a class="sourceLine" id="cb7-17" data-line-number="17"><span class="co"># E 0.442 0.457 0.529 0.481 0.531 0.774 10</span></a>
<a class="sourceLine" id="cb7-18" data-line-number="18"><span class="co"># F 0.447 0.510 0.554 0.568 0.609 0.618 10</span></a>
<a class="sourceLine" id="cb7-19" data-line-number="19"><span class="co"># G 0.443 0.470 0.492 0.477 0.506 0.601 10</span></a>
<a class="sourceLine" id="cb7-20" data-line-number="20"><span class="co"># H 0.448 0.459 0.491 0.466 0.515 0.633 10</span></a></code></pre></div>
<a class="sourceLine" id="cb7-13" data-line-number="13"><span class="co"># A 0.436 0.454 0.460 0.460 0.462 0.491 10</span></a>
<a class="sourceLine" id="cb7-14" data-line-number="14"><span class="co"># B 0.472 0.480 0.496 0.488 0.513 0.542 10</span></a>
<a class="sourceLine" id="cb7-15" data-line-number="15"><span class="co"># C 0.657 0.672 0.757 0.750 0.797 0.952 10</span></a>
<a class="sourceLine" id="cb7-16" data-line-number="16"><span class="co"># D 0.478 0.495 0.500 0.499 0.503 0.540 10</span></a>
<a class="sourceLine" id="cb7-17" data-line-number="17"><span class="co"># E 0.436 0.446 0.456 0.448 0.455 0.507 10</span></a>
<a class="sourceLine" id="cb7-18" data-line-number="18"><span class="co"># F 0.437 0.447 0.455 0.454 0.460 0.478 10</span></a>
<a class="sourceLine" id="cb7-19" data-line-number="19"><span class="co"># G 0.428 0.441 0.449 0.447 0.455 0.477 10</span></a>
<a class="sourceLine" id="cb7-20" data-line-number="20"><span class="co"># H 0.438 0.445 0.456 0.451 0.472 0.477 10</span></a></code></pre></div>
<p>Of course, when running <code><a href="../reference/mo_property.html">mo_phylum("Firmicutes")</a></code> the function has zero knowledge about the actual microorganism, namely <em>S. aureus</em>. But since the result would be <code>"Firmicutes"</code> too, there is no point in calculating the result. And because this package knows all phyla of all known bacteria (according to the Catalogue of Life), it can just return the initial value immediately.</p>
</div>
<div id="results-in-other-languages" class="section level3">
@ -351,13 +344,13 @@
<a class="sourceLine" id="cb8-18" data-line-number="18"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/print">print</a></span>(run_it, <span class="dt">unit =</span> <span class="st">"ms"</span>, <span class="dt">signif =</span> <span class="dv">4</span>)</a>
<a class="sourceLine" id="cb8-19" data-line-number="19"><span class="co"># Unit: milliseconds</span></a>
<a class="sourceLine" id="cb8-20" data-line-number="20"><span class="co"># expr min lq mean median uq max neval</span></a>
<a class="sourceLine" id="cb8-21" data-line-number="21"><span class="co"># en 19.29 20.39 22.42 20.64 21.26 38.98 10</span></a>
<a class="sourceLine" id="cb8-22" data-line-number="22"><span class="co"># de 22.03 22.40 23.78 23.08 23.60 31.74 10</span></a>
<a class="sourceLine" id="cb8-23" data-line-number="23"><span class="co"># nl 27.98 28.60 29.22 28.87 30.13 30.53 10</span></a>
<a class="sourceLine" id="cb8-24" data-line-number="24"><span class="co"># es 21.44 22.97 30.04 24.11 45.71 46.46 10</span></a>
<a class="sourceLine" id="cb8-25" data-line-number="25"><span class="co"># it 21.17 21.82 22.47 22.44 23.27 23.52 10</span></a>
<a class="sourceLine" id="cb8-26" data-line-number="26"><span class="co"># fr 20.75 21.58 24.10 22.04 22.41 42.96 10</span></a>
<a class="sourceLine" id="cb8-27" data-line-number="27"><span class="co"># pt 21.24 21.92 24.31 22.75 23.26 39.91 10</span></a></code></pre></div>
<a class="sourceLine" id="cb8-21" data-line-number="21"><span class="co"># en 17.21 17.67 18.20 18.40 18.62 18.81 10</span></a>
<a class="sourceLine" id="cb8-22" data-line-number="22"><span class="co"># de 18.76 19.01 21.59 19.45 19.82 41.96 10</span></a>
<a class="sourceLine" id="cb8-23" data-line-number="23"><span class="co"># nl 24.15 24.57 29.11 25.67 26.49 45.25 10</span></a>
<a class="sourceLine" id="cb8-24" data-line-number="24"><span class="co"># es 18.31 19.02 19.33 19.37 19.93 20.09 10</span></a>
<a class="sourceLine" id="cb8-25" data-line-number="25"><span class="co"># it 18.96 19.27 23.48 19.58 20.91 41.27 10</span></a>
<a class="sourceLine" id="cb8-26" data-line-number="26"><span class="co"># fr 18.33 18.80 19.46 19.27 19.97 21.10 10</span></a>
<a class="sourceLine" id="cb8-27" data-line-number="27"><span class="co"># pt 18.89 19.50 20.54 19.70 20.36 27.83 10</span></a></code></pre></div>
<p>Currently supported are German, Dutch, Spanish, Italian, French and Portuguese.</p>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9017</span>
</span>
</div>
@ -156,13 +156,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -242,7 +235,6 @@
<li><a href="SPSS.html">How to import data from SPSS / SAS / Stata</a></li>
<li><a href="WHONET.html">How to work with WHONET data</a></li>
<li><a href="benchmarks.html">Benchmarks</a></li>
<li><a href="freq.html">How to create frequency tables</a></li>
<li><a href="resistance_predict.html">How to predict antimicrobial resistance</a></li>
</ul>
</div>

View File

@ -40,7 +40,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -118,13 +118,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -192,7 +185,7 @@
<h1>How to predict antimicrobial resistance</h1>
<h4 class="author">Matthijs S. Berends</h4>
<h4 class="date">10 July 2019</h4>
<h4 class="date">29 July 2019</h4>
<div class="hidden name"><code>resistance_predict.Rmd</code></div>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9017</span>
</span>
</div>
@ -156,13 +156,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -42,7 +42,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9017</span>
</span>
</div>
@ -120,13 +120,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -190,9 +183,9 @@
</header><div class="row">
<div class="contents col-md-9">
<div id="amr-for-r-" class="section level1">
<div id="amr-for-r" class="section level1">
<div class="page-header"><h1 class="hasAnchor">
<a href="#amr-for-r-" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px">
<a href="#amr-for-r" class="anchor"></a><code>AMR</code> (for R) <img src="./logo.png" align="right" height="120px">
</h1></div>
<p><em>(<help title="Too Long, Didn't Read">TLDR</help> - to find out how to conduct AMR analysis, please <a href="./articles/AMR.html">continue reading here to get started</a>.</em></p>
<hr>
@ -213,7 +206,6 @@
<li>Plotting antimicrobial resistance (<a href="./articles/AMR.html">tutorial</a>)</li>
<li>Determining first isolates to be used for AMR analysis (<a href="./reference/first_isolate.html">manual</a>)</li>
<li>Applying EUCAST expert rules (<a href="./reference/eucast_rules.html">manual</a>)</li>
<li>Descriptive statistics: frequency tables, kurtosis and skewness (<a href="./articles/freq.html">tutorial</a>)</li>
</ul>
<p>This package is ready-to-use for a professional environment by specialists in the following fields:</p>
<p>Medical Microbiology</p>
@ -248,7 +240,7 @@
<h4 class="hasAnchor">
<a href="#latest-released-version" class="anchor"></a>Latest released version</h4>
<p>This package is available <a href="https://cran.r-project.org/package=AMR">on the official R network (CRAN)</a>, which has a peer-reviewed submission process. Install this package in R with:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/install.packages">install.packages</a></span>(<span class="st">"AMR"</span>)</a></code></pre></div>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/install.packages">install.packages</a></span>(<span class="st">"AMR"</span>)</a></code></pre></div>
<p>It will be downloaded and installed automatically. For RStudio, click on the menu <em>Tools</em> &gt; <em>Install Packages…</em> and then type in “AMR” and press <kbd>Install</kbd>.</p>
<p><strong>Note:</strong> Not all functions on this website may be available in this latest release. To use all functions and data sets mentioned on this website, install the latest development version.</p>
</div>
@ -256,8 +248,8 @@
<h4 class="hasAnchor">
<a href="#latest-development-version" class="anchor"></a>Latest development version</h4>
<p>The latest and unpublished development version can be installed with (<strong>precaution: may be unstable</strong>):</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/install.packages">install.packages</a></span>(<span class="st">"devtools"</span>)</a>
<a class="sourceLine" id="cb2-2" title="2">devtools<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/devtools/topics/reexports">install_gitlab</a></span>(<span class="st">"msberends/AMR"</span>)</a></code></pre></div>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/utils/topics/install.packages">install.packages</a></span>(<span class="st">"devtools"</span>)</a>
<a class="sourceLine" id="cb2-2" data-line-number="2">devtools<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/devtools/topics/reexports">install_gitlab</a></span>(<span class="st">"msberends/AMR"</span>)</a></code></pre></div>
</div>
</div>
<div id="get-started" class="section level2">
@ -299,9 +291,9 @@
<p><strong>NOTE: The WHOCC copyright does not allow use for commercial purposes, unlike any other info from this package. See \url{<a href="https://www.whocc.no/copyright_disclaimer/" class="uri">https://www.whocc.no/copyright_disclaimer/</a>}.</strong></p>
<p>Read more about the data from WHOCC <a href="./reference/WHOCC.html">in our manual</a>.</p>
</div>
<div id="whonet--ears-net" class="section level4">
<div id="whonet-ears-net" class="section level4">
<h4 class="hasAnchor">
<a href="#whonet--ears-net" class="anchor"></a>WHONET / EARS-Net</h4>
<a href="#whonet-ears-net" class="anchor"></a>WHONET / EARS-Net</h4>
<p><img src="./whonet.png"></p>
<p>We support WHONET and EARS-Net data. Exported files from WHONET can be imported into R and can be analysed easily using this package. For education purposes, we created an <a href="./reference/WHONET.html">example data set <code>WHONET</code></a> with the exact same structure as a WHONET export file. Furthermore, this package also contains a <a href="./reference/antibiotics.html">data set <code>antibiotics</code></a> with all EARS-Net antibiotic abbreviations, and knows almost all WHONET abbreviations for microorganisms. When using WHONET data as input for analysis, all input parameters will be set automatically.</p>
<p>Read our tutorial about <a href="./articles/WHONET.html">how to work with WHONET data here</a>.</p>
@ -340,8 +332,6 @@
<li>Calculate the resistance (and even co-resistance) of microbial isolates with the <code><a href="reference/portion.html">portion_R()</a></code>, <code><a href="reference/portion.html">portion_IR()</a></code>, <code><a href="reference/portion.html">portion_I()</a></code>, <code><a href="reference/portion.html">portion_SI()</a></code> and <code><a href="reference/portion.html">portion_S()</a></code> functions. Similarly, the <em>number</em> of isolates can be determined with the <code><a href="reference/count.html">count_R()</a></code>, <code><a href="reference/count.html">count_IR()</a></code>, <code><a href="reference/count.html">count_I()</a></code>, <code><a href="reference/count.html">count_SI()</a></code> and <code><a href="reference/count.html">count_S()</a></code> functions. All these functions can be used with the <code>dplyr</code> package (e.g. in conjunction with <code>summarise()</code>)</li>
<li>Plot AMR results with <code><a href="reference/ggplot_rsi.html">geom_rsi()</a></code>, a function made for the <code>ggplot2</code> package</li>
<li>Predict antimicrobial resistance for the nextcoming years using logistic regression models with the <code><a href="reference/resistance_predict.html">resistance_predict()</a></code> function</li>
<li>Conduct descriptive statistics to enhance base R: calculate <code><a href="reference/kurtosis.html">kurtosis()</a></code>, <code><a href="reference/skewness.html">skewness()</a></code> and create frequency tables with <code><a href="reference/freq.html">freq()</a></code>
</li>
</ul>
</li>
<li>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9017</span>
</span>
</div>
@ -156,13 +156,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -232,39 +225,46 @@
</div>
<div id="amr-0719013" class="section level1">
<div id="amr-0-7-1-9017" class="section level1">
<h1 class="page-header">
<a href="#amr-0719013" class="anchor"></a>AMR 0.7.1.9013<small> Unreleased </small>
<a href="#amr-0-7-1-9017" class="anchor"></a>AMR 0.7.1.9017<small> Unreleased </small>
</h1>
<div id="breaking" class="section level3">
<h3 class="hasAnchor">
<a href="#breaking" class="anchor"></a>Breaking</h3>
<ul>
<li>Function <code>freq()</code> has moved to a new package, <a href="https://github.com/msberends/clean"><code>clean</code></a> (<a href="https://cran.r-project.org/package=clean">CRAN link</a>). Creating frequency tables is actually not the scope of this package (never was) and this function has matured a lot over the last two years. We decided to create a new package for data cleaning and checking and it perfectly fits the <code>freq()</code> function. The <a href="https://github.com/msberends/clean"><code>clean</code></a> package is available on CRAN and will be installed automatically when updating the <code>AMR</code> package, that now imports it. In a later stage, the <code><a href="../reference/skewness.html">skewness()</a></code> and <code><a href="../reference/kurtosis.html">kurtosis()</a></code> functions will be moved to the <code>clean</code> package too.</li>
</ul>
</div>
<div id="new" class="section level3">
<h3 class="hasAnchor">
<a href="#new" class="anchor"></a>New</h3>
<ul>
<li>
<p>Additional way to calculate co-resistance, i.e. when using multiple antibiotics as input for <code>portion_*</code> functions or <code>count_*</code> functions. This can be used to determine the empiric susceptibily of a combination therapy. A new parameter <code>only_all_tested</code> (<strong>which defaults to <code>FALSE</code></strong>) replaces the old <code>also_single_tested</code> and can be used to select one of the two methods to count isolates and calculate portions. The difference can be seen in this example table (which is also on the <code>portion</code> and <code>count</code> help pages), where the %SI is being determined:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="co"># -------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb1-2" title="2"><span class="co"># only_all_tested = FALSE only_all_tested = TRUE</span></a>
<a class="sourceLine" id="cb1-3" title="3"><span class="co"># Antibiotic Antibiotic ----------------------- -----------------------</span></a>
<a class="sourceLine" id="cb1-4" title="4"><span class="co"># A B include as include as include as include as</span></a>
<a class="sourceLine" id="cb1-5" title="5"><span class="co"># numerator denominator numerator denominator</span></a>
<a class="sourceLine" id="cb1-6" title="6"><span class="co"># ---------- ---------- ---------- ----------- ---------- -----------</span></a>
<a class="sourceLine" id="cb1-7" title="7"><span class="co"># S S X X X X</span></a>
<a class="sourceLine" id="cb1-8" title="8"><span class="co"># I S X X X X</span></a>
<a class="sourceLine" id="cb1-9" title="9"><span class="co"># R S X X X X</span></a>
<a class="sourceLine" id="cb1-10" title="10"><span class="co"># not tested S X X - -</span></a>
<a class="sourceLine" id="cb1-11" title="11"><span class="co"># S I X X X X</span></a>
<a class="sourceLine" id="cb1-12" title="12"><span class="co"># I I X X X X</span></a>
<a class="sourceLine" id="cb1-13" title="13"><span class="co"># R I X X X X</span></a>
<a class="sourceLine" id="cb1-14" title="14"><span class="co"># not tested I X X - -</span></a>
<a class="sourceLine" id="cb1-15" title="15"><span class="co"># S R X X X X</span></a>
<a class="sourceLine" id="cb1-16" title="16"><span class="co"># I R X X X X</span></a>
<a class="sourceLine" id="cb1-17" title="17"><span class="co"># R R - X - X</span></a>
<a class="sourceLine" id="cb1-18" title="18"><span class="co"># not tested R - - - -</span></a>
<a class="sourceLine" id="cb1-19" title="19"><span class="co"># S not tested X X - -</span></a>
<a class="sourceLine" id="cb1-20" title="20"><span class="co"># I not tested X X - -</span></a>
<a class="sourceLine" id="cb1-21" title="21"><span class="co"># R not tested - - - -</span></a>
<a class="sourceLine" id="cb1-22" title="22"><span class="co"># not tested not tested - - - -</span></a>
<a class="sourceLine" id="cb1-23" title="23"><span class="co"># -------------------------------------------------------------------------</span></a></code></pre></div>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="co"># -------------------------------------------------------------------------</span></a>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="co"># only_all_tested = FALSE only_all_tested = TRUE</span></a>
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="co"># Antibiotic Antibiotic ----------------------- -----------------------</span></a>
<a class="sourceLine" id="cb1-4" data-line-number="4"><span class="co"># A B include as include as include as include as</span></a>
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="co"># numerator denominator numerator denominator</span></a>
<a class="sourceLine" id="cb1-6" data-line-number="6"><span class="co"># ---------- ---------- ---------- ----------- ---------- -----------</span></a>
<a class="sourceLine" id="cb1-7" data-line-number="7"><span class="co"># S S X X X X</span></a>
<a class="sourceLine" id="cb1-8" data-line-number="8"><span class="co"># I S X X X X</span></a>
<a class="sourceLine" id="cb1-9" data-line-number="9"><span class="co"># R S X X X X</span></a>
<a class="sourceLine" id="cb1-10" data-line-number="10"><span class="co"># not tested S X X - -</span></a>
<a class="sourceLine" id="cb1-11" data-line-number="11"><span class="co"># S I X X X X</span></a>
<a class="sourceLine" id="cb1-12" data-line-number="12"><span class="co"># I I X X X X</span></a>
<a class="sourceLine" id="cb1-13" data-line-number="13"><span class="co"># R I X X X X</span></a>
<a class="sourceLine" id="cb1-14" data-line-number="14"><span class="co"># not tested I X X - -</span></a>
<a class="sourceLine" id="cb1-15" data-line-number="15"><span class="co"># S R X X X X</span></a>
<a class="sourceLine" id="cb1-16" data-line-number="16"><span class="co"># I R X X X X</span></a>
<a class="sourceLine" id="cb1-17" data-line-number="17"><span class="co"># R R - X - X</span></a>
<a class="sourceLine" id="cb1-18" data-line-number="18"><span class="co"># not tested R - - - -</span></a>
<a class="sourceLine" id="cb1-19" data-line-number="19"><span class="co"># S not tested X X - -</span></a>
<a class="sourceLine" id="cb1-20" data-line-number="20"><span class="co"># I not tested X X - -</span></a>
<a class="sourceLine" id="cb1-21" data-line-number="21"><span class="co"># R not tested - - - -</span></a>
<a class="sourceLine" id="cb1-22" data-line-number="22"><span class="co"># not tested not tested - - - -</span></a>
<a class="sourceLine" id="cb1-23" data-line-number="23"><span class="co"># -------------------------------------------------------------------------</span></a></code></pre></div>
<p>Since this is a major change, usage of the old <code>also_single_tested</code> will throw an informative error that it has been replaced by <code>only_all_tested</code>.</p>
</li>
</ul>
@ -289,9 +289,9 @@
</ul>
</div>
</div>
<div id="amr-071" class="section level1">
<div id="amr-0-7-1" class="section level1">
<h1 class="page-header">
<a href="#amr-071" class="anchor"></a>AMR 0.7.1<small> 2019-06-23 </small>
<a href="#amr-0-7-1" class="anchor"></a>AMR 0.7.1<small> 2019-06-23 </small>
</h1>
<div id="new-1" class="section level4">
<h4 class="hasAnchor">
@ -299,14 +299,14 @@
<ul>
<li>
<p>Function <code><a href="../reference/portion.html">rsi_df()</a></code> to transform a <code>data.frame</code> to a data set containing only the microbial interpretation (S, I, R), the antibiotic, the percentage of S/I/R and the number of available isolates. This is a convenient combination of the existing functions <code><a href="../reference/count.html">count_df()</a></code> and <code><a href="../reference/portion.html">portion_df()</a></code> to immediately show resistance percentages and number of available isolates:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" title="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-2" title="2"><span class="st"> </span><span class="kw">select</span>(AMX, CIP) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/portion.html">rsi_df</a></span>()</a>
<a class="sourceLine" id="cb2-4" title="4"><span class="co"># antibiotic interpretation value isolates</span></a>
<a class="sourceLine" id="cb2-5" title="5"><span class="co"># 1 Amoxicillin SI 0.4442636 546</span></a>
<a class="sourceLine" id="cb2-6" title="6"><span class="co"># 2 Amoxicillin R 0.5557364 683</span></a>
<a class="sourceLine" id="cb2-7" title="7"><span class="co"># 3 Ciprofloxacin SI 0.8381831 1181</span></a>
<a class="sourceLine" id="cb2-8" title="8"><span class="co"># 4 Ciprofloxacin R 0.1618169 228</span></a></code></pre></div>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="st"> </span><span class="kw">select</span>(AMX, CIP) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="../reference/portion.html">rsi_df</a></span>()</a>
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="co"># antibiotic interpretation value isolates</span></a>
<a class="sourceLine" id="cb2-5" data-line-number="5"><span class="co"># 1 Amoxicillin SI 0.4442636 546</span></a>
<a class="sourceLine" id="cb2-6" data-line-number="6"><span class="co"># 2 Amoxicillin R 0.5557364 683</span></a>
<a class="sourceLine" id="cb2-7" data-line-number="7"><span class="co"># 3 Ciprofloxacin SI 0.8381831 1181</span></a>
<a class="sourceLine" id="cb2-8" data-line-number="8"><span class="co"># 4 Ciprofloxacin R 0.1618169 228</span></a></code></pre></div>
</li>
<li>
<p>Support for all scientifically published pathotypes of <em>E. coli</em> to date (that we could find). Supported are:</p>
@ -324,12 +324,12 @@
<li>UPEC (Uropathogenic <em>E. coli</em>)</li>
</ul>
<p>All these lead to the microbial ID of <em>E. coli</em>:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb3-2" title="2"><span class="co"># B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb3-3" title="3"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb3-4" title="4"><span class="co"># "Escherichia coli"</span></a>
<a class="sourceLine" id="cb3-5" title="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"EHEC"</span>)</a>
<a class="sourceLine" id="cb3-6" title="6"><span class="co"># "Gram-negative"</span></a></code></pre></div>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="co"># B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_name</a></span>(<span class="st">"UPEC"</span>)</a>
<a class="sourceLine" id="cb3-4" data-line-number="4"><span class="co"># "Escherichia coli"</span></a>
<a class="sourceLine" id="cb3-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"EHEC"</span>)</a>
<a class="sourceLine" id="cb3-6" data-line-number="6"><span class="co"># "Gram-negative"</span></a></code></pre></div>
</li>
<li>Function <code><a href="../reference/mo_property.html">mo_info()</a></code> as an analogy to <code><a href="../reference/ab_property.html">ab_info()</a></code>. The <code><a href="../reference/mo_property.html">mo_info()</a></code> prints a list with the full taxonomy, authors, and the URL to the online database of a microorganism</li>
<li><p>Function <code><a href="../reference/mo_property.html">mo_synonyms()</a></code> to get all previously accepted taxonomic names of a microorganism</p></li>
@ -370,9 +370,9 @@
</ul>
</div>
</div>
<div id="amr-070" class="section level1">
<div id="amr-0-7-0" class="section level1">
<h1 class="page-header">
<a href="#amr-070" class="anchor"></a>AMR 0.7.0<small> 2019-06-03 </small>
<a href="#amr-0-7-0" class="anchor"></a>AMR 0.7.0<small> 2019-06-03 </small>
</h1>
<div id="new-2" class="section level4">
<h4 class="hasAnchor">
@ -421,21 +421,21 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=Tra
<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>rsi()</code>
</li>
<li>Frequency tables (<code><a href="../reference/freq.html">freq()</a></code>):
<li>Frequency tables (<code>freq()</code>):
<ul>
<li>speed improvement for microbial IDs</li>
<li>fixed factor level names for R Markdown</li>
<li>when all values are unique it now shows a message instead of a warning</li>
<li>
<p>support for boxplots:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" title="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(age) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-3" title="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/boxplot">boxplot</a></span>()</a>
<a class="sourceLine" id="cb4-4" title="4"><span class="co"># grouped boxplots:</span></a>
<a class="sourceLine" id="cb4-5" title="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-6" title="6"><span class="st"> </span><span class="kw">group_by</span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-7" title="7"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(age) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-8" title="8"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/boxplot">boxplot</a></span>()</a></code></pre></div>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb4-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="st"> </span><span class="kw">freq</span>(age) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/boxplot">boxplot</a></span>()</a>
<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="co"># grouped boxplots:</span></a>
<a class="sourceLine" id="cb4-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="st"> </span><span class="kw">group_by</span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="st"> </span><span class="kw">freq</span>(age) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/boxplot">boxplot</a></span>()</a></code></pre></div>
</li>
</ul>
</li>
@ -445,7 +445,7 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=EUC
<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><a href="../reference/freq.html">freq()</a></code> for when all values are <code>NA</code>
<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>
@ -467,9 +467,9 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=EUC
</ul>
</div>
</div>
<div id="amr-061" class="section level1">
<div id="amr-0-6-1" class="section level1">
<h1 class="page-header">
<a href="#amr-061" class="anchor"></a>AMR 0.6.1<small> 2019-03-29 </small>
<a href="#amr-0-6-1" class="anchor"></a>AMR 0.6.1<small> 2019-03-29 </small>
</h1>
<div id="changed-3" class="section level4">
<h4 class="hasAnchor">
@ -481,9 +481,9 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=EUC
</ul>
</div>
</div>
<div id="amr-060" class="section level1">
<div id="amr-0-6-0" class="section level1">
<h1 class="page-header">
<a href="#amr-060" class="anchor"></a>AMR 0.6.0<small> 2019-03-27 </small>
<a href="#amr-0-6-0" class="anchor"></a>AMR 0.6.0<small> 2019-03-27 </small>
</h1>
<p><strong>New website!</strong></p>
<p>Weve got a new website: <a href="https://msberends.gitlab.io/AMR/">https://msberends.gitlab.io/AMR</a> (built with the great <a href="https://pkgdown.r-lib.org/"><code>pkgdown</code></a>)</p>
@ -506,7 +506,7 @@ Please <a href="https://gitlab.com/msberends/AMR/issues/new?issue%5Btitle%5D=EUC
<li>
<p>The responsible author(s) and year of scientific publication</p>
This data is updated annually - check the included version with the new function <code><a href="../reference/catalogue_of_life_version.html">catalogue_of_life_version()</a></code>.</li>
<li>Due to this change, some <code>mo</code> codes changed (e.g. <em>Streptococcus</em> changed from <code>B_STRPTC</code> to <code>B_STRPT</code>). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.</li>
<li>Due to this change, some <code>mo</code> codes changed (e.g. <em>Streptococcus</em> changed from <code>B_STRPTC</code> to <code>B_STRPT</code>). A translation table is used internally to support older microorganism IDs, so users will not notice this difference.</li>
<li>New function <code><a href="../reference/mo_property.html">mo_rank()</a></code> for the taxonomic rank (genus, species, infraspecies, etc.)</li>
<li>New function <code><a href="../reference/mo_property.html">mo_url()</a></code> to get the direct URL of a species from the Catalogue of Life</li>
</ul>
@ -520,33 +520,33 @@ This data is updated annually - check the included version with the new function
</li>
<li>
<p>New filters for antimicrobial classes. Use these functions to filter isolates on results in one of more antibiotics from a specific class:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"><span class="kw"><a href="../reference/filter_ab_class.html">filter_aminoglycosides</a></span>()</a>
<a class="sourceLine" id="cb5-2" title="2"><span class="kw"><a href="../reference/filter_ab_class.html">filter_carbapenems</a></span>()</a>
<a class="sourceLine" id="cb5-3" title="3"><span class="kw"><a href="../reference/filter_ab_class.html">filter_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-4" title="4"><span class="kw"><a href="../reference/filter_ab_class.html">filter_1st_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-5" title="5"><span class="kw"><a href="../reference/filter_ab_class.html">filter_2nd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-6" title="6"><span class="kw"><a href="../reference/filter_ab_class.html">filter_3rd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-7" title="7"><span class="kw"><a href="../reference/filter_ab_class.html">filter_4th_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-8" title="8"><span class="kw"><a href="../reference/filter_ab_class.html">filter_fluoroquinolones</a></span>()</a>
<a class="sourceLine" id="cb5-9" title="9"><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>()</a>
<a class="sourceLine" id="cb5-10" title="10"><span class="kw"><a href="../reference/filter_ab_class.html">filter_macrolides</a></span>()</a>
<a class="sourceLine" id="cb5-11" title="11"><span class="kw"><a href="../reference/filter_ab_class.html">filter_tetracyclines</a></span>()</a></code></pre></div>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="kw"><a href="../reference/filter_ab_class.html">filter_aminoglycosides</a></span>()</a>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="kw"><a href="../reference/filter_ab_class.html">filter_carbapenems</a></span>()</a>
<a class="sourceLine" id="cb5-3" data-line-number="3"><span class="kw"><a href="../reference/filter_ab_class.html">filter_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-4" data-line-number="4"><span class="kw"><a href="../reference/filter_ab_class.html">filter_1st_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-5" data-line-number="5"><span class="kw"><a href="../reference/filter_ab_class.html">filter_2nd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-6" data-line-number="6"><span class="kw"><a href="../reference/filter_ab_class.html">filter_3rd_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-7" data-line-number="7"><span class="kw"><a href="../reference/filter_ab_class.html">filter_4th_cephalosporins</a></span>()</a>
<a class="sourceLine" id="cb5-8" data-line-number="8"><span class="kw"><a href="../reference/filter_ab_class.html">filter_fluoroquinolones</a></span>()</a>
<a class="sourceLine" id="cb5-9" data-line-number="9"><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>()</a>
<a class="sourceLine" id="cb5-10" data-line-number="10"><span class="kw"><a href="../reference/filter_ab_class.html">filter_macrolides</a></span>()</a>
<a class="sourceLine" id="cb5-11" data-line-number="11"><span class="kw"><a href="../reference/filter_ab_class.html">filter_tetracyclines</a></span>()</a></code></pre></div>
<p>The <code>antibiotics</code> data set will be searched, after which the input data will be checked for column names with a value in any abbreviations, codes or official names found in the <code>antibiotics</code> data set. For example:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>)</a>
<a class="sourceLine" id="cb6-2" title="2"><span class="co"># Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R</span></a>
<a class="sourceLine" id="cb6-3" title="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>, <span class="dt">scope =</span> <span class="st">"all"</span>)</a>
<a class="sourceLine" id="cb6-4" title="4"><span class="co"># Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R</span></a></code></pre></div>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>)</a>
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># Filtering on glycopeptide antibacterials: any of `vanc` or `teic` is R</span></a>
<a class="sourceLine" id="cb6-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/filter_ab_class.html">filter_glycopeptides</a></span>(<span class="dt">result =</span> <span class="st">"R"</span>, <span class="dt">scope =</span> <span class="st">"all"</span>)</a>
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="co"># Filtering on glycopeptide antibacterials: all of `vanc` and `teic` is R</span></a></code></pre></div>
</li>
<li>
<p>All <code>ab_*</code> functions are deprecated and replaced by <code>atc_*</code> functions:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">ab_property -&gt;<span class="st"> </span><span class="kw">atc_property</span>()</a>
<a class="sourceLine" id="cb7-2" title="2">ab_name -&gt;<span class="st"> </span><span class="kw">atc_name</span>()</a>
<a class="sourceLine" id="cb7-3" title="3">ab_official -&gt;<span class="st"> </span><span class="kw">atc_official</span>()</a>
<a class="sourceLine" id="cb7-4" title="4">ab_trivial_nl -&gt;<span class="st"> </span><span class="kw">atc_trivial_nl</span>()</a>
<a class="sourceLine" id="cb7-5" title="5">ab_certe -&gt;<span class="st"> </span><span class="kw">atc_certe</span>()</a>
<a class="sourceLine" id="cb7-6" title="6">ab_umcg -&gt;<span class="st"> </span><span class="kw">atc_umcg</span>()</a>
<a class="sourceLine" id="cb7-7" title="7">ab_tradenames -&gt;<span class="st"> </span><span class="kw">atc_tradenames</span>()</a></code></pre></div>
These functions use <code><a href="../reference/AMR-deprecated.html">as.atc()</a></code> internally. The old <code>atc_property</code> has been renamed <code><a href="../reference/atc_online.html">atc_online_property()</a></code>. This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class <code>atc</code> or must be coerable to this class. Properties of these classes should start with the same class name, analogous to <code><a href="../reference/as.mo.html">as.mo()</a></code> and e.g. <code>mo_genus</code>.</li>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">ab_property -&gt;<span class="st"> </span><span class="kw">atc_property</span>()</a>
<a class="sourceLine" id="cb7-2" data-line-number="2">ab_name -&gt;<span class="st"> </span><span class="kw">atc_name</span>()</a>
<a class="sourceLine" id="cb7-3" data-line-number="3">ab_official -&gt;<span class="st"> </span><span class="kw">atc_official</span>()</a>
<a class="sourceLine" id="cb7-4" data-line-number="4">ab_trivial_nl -&gt;<span class="st"> </span><span class="kw">atc_trivial_nl</span>()</a>
<a class="sourceLine" id="cb7-5" data-line-number="5">ab_certe -&gt;<span class="st"> </span><span class="kw">atc_certe</span>()</a>
<a class="sourceLine" id="cb7-6" data-line-number="6">ab_umcg -&gt;<span class="st"> </span><span class="kw">atc_umcg</span>()</a>
<a class="sourceLine" id="cb7-7" data-line-number="7">ab_tradenames -&gt;<span class="st"> </span><span class="kw">atc_tradenames</span>()</a></code></pre></div>
These functions use <code><a href="../reference/AMR-deprecated.html">as.atc()</a></code> internally. The old <code>atc_property</code> has been renamed <code><a href="../reference/atc_online.html">atc_online_property()</a></code>. This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class <code>atc</code> or must be coerable to this class. Properties of these classes should start with the same class name, analogous to <code><a href="../reference/as.mo.html">as.mo()</a></code> and e.g. <code>mo_genus</code>.</li>
<li>New functions <code><a href="../reference/mo_source.html">set_mo_source()</a></code> and <code><a href="../reference/mo_source.html">get_mo_source()</a></code> to use your own predefined MO codes as input for <code><a href="../reference/as.mo.html">as.mo()</a></code> and consequently all <code>mo_*</code> functions</li>
<li>Support for the upcoming <a href="https://dplyr.tidyverse.org"><code>dplyr</code></a> version 0.8.0</li>
<li>New function <code><a href="../reference/guess_ab_col.html">guess_ab_col()</a></code> to find an antibiotic column in a table</li>
@ -557,20 +557,20 @@ These functions use <code><a href="../reference/AMR-deprecated.html">as.atc()</a
<li>New function <code><a href="../reference/age_groups.html">age_groups()</a></code> to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.</li>
<li>
<p>New function <code><a href="../reference/resistance_predict.html">ggplot_rsi_predict()</a></code> as well as the base R <code><a href="https://www.rdocumentation.org/packages/graphics/topics/plot">plot()</a></code> function can now be used for resistance prediction calculated with <code><a href="../reference/resistance_predict.html">resistance_predict()</a></code>:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(septic_patients, <span class="dt">col_ab =</span> <span class="st">"amox"</span>)</a>
<a class="sourceLine" id="cb8-2" title="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/plot">plot</a></span>(x)</a>
<a class="sourceLine" id="cb8-3" title="3"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(x)</a></code></pre></div>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" data-line-number="1">x &lt;-<span class="st"> </span><span class="kw"><a href="../reference/resistance_predict.html">resistance_predict</a></span>(septic_patients, <span class="dt">col_ab =</span> <span class="st">"amox"</span>)</a>
<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="kw"><a href="https://www.rdocumentation.org/packages/graphics/topics/plot">plot</a></span>(x)</a>
<a class="sourceLine" id="cb8-3" data-line-number="3"><span class="kw"><a href="../reference/resistance_predict.html">ggplot_rsi_predict</a></span>(x)</a></code></pre></div>
</li>
<li>
<p>Functions <code><a href="../reference/first_isolate.html">filter_first_isolate()</a></code> and <code><a href="../reference/first_isolate.html">filter_first_weighted_isolate()</a></code> to shorten and fasten filtering on data sets with antimicrobial results, e.g.:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(...)</a>
<a class="sourceLine" id="cb9-2" title="2"><span class="co"># or</span></a>
<a class="sourceLine" id="cb9-3" title="3"><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(septic_patients, ...)</a></code></pre></div>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(...)</a>
<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="co"># or</span></a>
<a class="sourceLine" id="cb9-3" data-line-number="3"><span class="kw"><a href="../reference/first_isolate.html">filter_first_isolate</a></span>(septic_patients, ...)</a></code></pre></div>
<p>is equal to:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" title="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb10-2" title="2"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">only_firsts =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(septic_patients, ...)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb10-3" title="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/filter">filter</a></span>(only_firsts <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb10-4" title="4"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>only_firsts)</a></code></pre></div>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">only_firsts =</span> <span class="kw"><a href="../reference/first_isolate.html">first_isolate</a></span>(septic_patients, ...)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb10-3" data-line-number="3"><span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/stats/topics/filter">filter</a></span>(only_firsts <span class="op">==</span><span class="st"> </span><span class="ot">TRUE</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>only_firsts)</a></code></pre></div>
</li>
<li>New function <code><a href="../reference/availability.html">availability()</a></code> to check the number of available (non-empty) results in a <code>data.frame</code>
</li>
@ -599,33 +599,33 @@ These functions use <code><a href="../reference/AMR-deprecated.html">as.atc()</a
<ul>
<li>
<p>Now handles incorrect spelling, like <code>i</code> instead of <code>y</code> and <code>f</code> instead of <code>ph</code>:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" title="1"><span class="co"># mo_fullname() uses as.mo() internally</span></a>
<a class="sourceLine" id="cb11-2" title="2"></a>
<a class="sourceLine" id="cb11-3" title="3"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Sthafilokockus aaureuz"</span>)</a>
<a class="sourceLine" id="cb11-4" title="4"><span class="co">#&gt; [1] "Staphylococcus aureus"</span></a>
<a class="sourceLine" id="cb11-5" title="5"></a>
<a class="sourceLine" id="cb11-6" title="6"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. klossi"</span>)</a>
<a class="sourceLine" id="cb11-7" title="7"><span class="co">#&gt; [1] "Staphylococcus kloosii"</span></a></code></pre></div>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1"><span class="co"># mo_fullname() uses as.mo() internally</span></a>
<a class="sourceLine" id="cb11-2" data-line-number="2"></a>
<a class="sourceLine" id="cb11-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"Sthafilokockus aaureuz"</span>)</a>
<a class="sourceLine" id="cb11-4" data-line-number="4"><span class="co">#&gt; [1] "Staphylococcus aureus"</span></a>
<a class="sourceLine" id="cb11-5" data-line-number="5"></a>
<a class="sourceLine" id="cb11-6" data-line-number="6"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. klossi"</span>)</a>
<a class="sourceLine" id="cb11-7" data-line-number="7"><span class="co">#&gt; [1] "Staphylococcus kloosii"</span></a></code></pre></div>
</li>
<li>
<p>Uncertainty of the algorithm is now divided into four levels, 0 to 3, where the default <code>allow_uncertain = TRUE</code> is equal to uncertainty level 2. Run <code><a href="../reference/as.mo.html">?as.mo</a></code> for more info about these levels.</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1"><span class="co"># equal:</span></a>
<a class="sourceLine" id="cb12-2" title="2"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb12-3" title="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb12-4" title="4"></a>
<a class="sourceLine" id="cb12-5" title="5"><span class="co"># also equal:</span></a>
<a class="sourceLine" id="cb12-6" title="6"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">FALSE</span>)</a>
<a class="sourceLine" id="cb12-7" title="7"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">0</span>)</a></code></pre></div>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" data-line-number="1"><span class="co"># equal:</span></a>
<a class="sourceLine" id="cb12-2" data-line-number="2"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">TRUE</span>)</a>
<a class="sourceLine" id="cb12-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">2</span>)</a>
<a class="sourceLine" id="cb12-4" data-line-number="4"></a>
<a class="sourceLine" id="cb12-5" data-line-number="5"><span class="co"># also equal:</span></a>
<a class="sourceLine" id="cb12-6" data-line-number="6"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="ot">FALSE</span>)</a>
<a class="sourceLine" id="cb12-7" data-line-number="7"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(..., <span class="dt">allow_uncertain =</span> <span class="dv">0</span>)</a></code></pre></div>
Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a></code> could lead to very unreliable results.</li>
<li>Implemented the latest publication of Becker <em>et al.</em> (2019), for categorising coagulase-negative <em>Staphylococci</em>
</li>
<li>All microbial IDs that found are now saved to a local file <code>~/.Rhistory_mo</code>. Use the new function <code>clean_mo_history()</code> to delete this file, which resets the algorithms.</li>
<li>
<p>Incoercible results will now be considered unknown, MO code <code>UNKNOWN</code>. On foreign systems, properties of these will be translated to all languages already previously supported: German, Dutch, French, Italian, Spanish and Portuguese:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" title="1"><span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, <span class="dt">language =</span> <span class="st">"es"</span>)</a>
<a class="sourceLine" id="cb13-2" title="2"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb13-3" title="3"><span class="co"># one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.</span></a>
<a class="sourceLine" id="cb13-4" title="4"><span class="co">#&gt; [1] "(género desconocido)"</span></a></code></pre></div>
<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(<span class="st">"qwerty"</span>, <span class="dt">language =</span> <span class="st">"es"</span>)</a>
<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="co"># Warning: </span></a>
<a class="sourceLine" id="cb13-3" data-line-number="3"><span class="co"># one unique value (^= 100.0%) could not be coerced and is considered 'unknown': "qwerty". Use mo_failures() to review it.</span></a>
<a class="sourceLine" id="cb13-4" data-line-number="4"><span class="co">#&gt; [1] "(género desconocido)"</span></a></code></pre></div>
</li>
<li>Fix for vector containing only empty values</li>
<li>Finds better results when input is in other languages</li>
@ -667,23 +667,23 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
</ul>
</li>
<li>Frequency tables (<code><a href="../reference/freq.html">freq()</a></code> function):
<li>Frequency tables (<code>freq()</code> function):
<ul>
<li>
<p>Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" title="1"><span class="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span></a>
<a class="sourceLine" id="cb14-2" title="2"><span class="co"># OLD WAY</span></a>
<a class="sourceLine" id="cb14-3" title="3">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb14-4" title="4"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">genus =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb14-5" title="5"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(genus)</a>
<a class="sourceLine" id="cb14-6" title="6"><span class="co"># NEW WAY</span></a>
<a class="sourceLine" id="cb14-7" title="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-8" title="8"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a>
<a class="sourceLine" id="cb14-9" title="9"></a>
<a class="sourceLine" id="cb14-10" title="10"><span class="co"># Even supports grouping variables:</span></a>
<a class="sourceLine" id="cb14-11" title="11">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb14-12" title="12"><span class="st"> </span><span class="kw">group_by</span>(gender) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-13" title="13"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a></code></pre></div>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" data-line-number="1"><span class="co"># Determine genus of microorganisms (mo) in `septic_patients` data set:</span></a>
<a class="sourceLine" id="cb14-2" data-line-number="2"><span class="co"># OLD WAY</span></a>
<a class="sourceLine" id="cb14-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb14-4" data-line-number="4"><span class="st"> </span><span class="kw">mutate</span>(<span class="dt">genus =</span> <span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo)) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb14-5" data-line-number="5"><span class="st"> </span><span class="kw">freq</span>(genus)</a>
<a class="sourceLine" id="cb14-6" data-line-number="6"><span class="co"># NEW WAY</span></a>
<a class="sourceLine" id="cb14-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-8" data-line-number="8"><span class="st"> </span><span class="kw">freq</span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a>
<a class="sourceLine" id="cb14-9" data-line-number="9"></a>
<a class="sourceLine" id="cb14-10" data-line-number="10"><span class="co"># Even supports grouping variables:</span></a>
<a class="sourceLine" id="cb14-11" data-line-number="11">septic_patients <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb14-12" data-line-number="12"><span class="st"> </span><span class="kw">group_by</span>(gender) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb14-13" data-line-number="13"><span class="st"> </span><span class="kw">freq</span>(<span class="kw"><a href="../reference/mo_property.html">mo_genus</a></span>(mo))</a></code></pre></div>
</li>
<li>Header info is now available as a list, with the <code>header</code> function</li>
<li>The parameter <code>header</code> is now set to <code>TRUE</code> at default, even for markdown</li>
@ -714,9 +714,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</ul>
</div>
</div>
<div id="amr-050" class="section level1">
<div id="amr-0-5-0" class="section level1">
<h1 class="page-header">
<a href="#amr-050" class="anchor"></a>AMR 0.5.0<small> 2018-11-30 </small>
<a href="#amr-0-5-0" class="anchor"></a>AMR 0.5.0<small> 2018-11-30 </small>
</h1>
<div id="new-4" class="section level4">
<h4 class="hasAnchor">
@ -758,10 +758,10 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Fewer than 3 characters as input for <code>as.mo</code> will return NA</li>
<li>
<p>Function <code>as.mo</code> (and all <code>mo_*</code> wrappers) now supports genus abbreviations with “species” attached</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" title="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
<a class="sourceLine" id="cb15-2" title="2"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
<a class="sourceLine" id="cb15-3" title="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
<a class="sourceLine" id="cb15-4" title="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. species"</span>) <span class="co"># B_ESCHR</span></a>
<a class="sourceLine" id="cb15-2" data-line-number="2"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"E. spp."</span>) <span class="co"># "Escherichia species"</span></a>
<a class="sourceLine" id="cb15-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S. spp"</span>) <span class="co"># B_STPHY</span></a>
<a class="sourceLine" id="cb15-4" data-line-number="4"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. species"</span>) <span class="co"># "Staphylococcus species"</span></a></code></pre></div>
</li>
<li>Added parameter <code>combine_IR</code> (TRUE/FALSE) to functions <code>portion_df</code> and <code>count_df</code>, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)</li>
<li>Fix for <code>portion_*(..., as_percent = TRUE)</code> when minimal number of isolates would not be met</li>
@ -770,21 +770,21 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Using <code>portion_*</code> functions now throws a warning when total available isolate is below parameter <code>minimum</code>
</li>
<li>Functions <code>as.mo</code>, <code>as.rsi</code>, <code>as.mic</code>, <code>as.atc</code> and <code>freq</code> will not set package name as attribute anymore</li>
<li>Frequency tables - <code><a href="../reference/freq.html">freq()</a></code>:
<li>Frequency tables - <code>freq()</code>:
<ul>
<li>
<p>Support for grouping variables, test with:</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" title="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb16-2" title="2"><span class="st"> </span><span class="kw">group_by</span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb16-3" title="3"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(gender)</a></code></pre></div>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="st"> </span><span class="kw">group_by</span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb16-3" data-line-number="3"><span class="st"> </span><span class="kw">freq</span>(gender)</a></code></pre></div>
</li>
<li>
<p>Support for (un)selecting columns:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" title="2"><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-3" title="3"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>count, <span class="op">-</span>cum_count) <span class="co"># only get item, percent, cum_percent</span></a></code></pre></div>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-2" data-line-number="2"><span class="st"> </span><span class="kw">freq</span>(hospital_id) <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb17-3" data-line-number="3"><span class="st"> </span><span class="kw">select</span>(<span class="op">-</span>count, <span class="op">-</span>cum_count) <span class="co"># only get item, percent, cum_percent</span></a></code></pre></div>
</li>
<li>Check for <code><a href="https://www.rdocumentation.org/packages/hms/topics/hms">hms::is.hms</a></code>
<li>Check for <code><a href="https://www.rdocumentation.org/packages/hms/topics/Deprecated">hms::is.hms</a></code>
</li>
<li>Now prints in markdown at default in non-interactive sessions</li>
<li>No longer adds the factor level column and sorts factors on count again</li>
@ -802,7 +802,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Removed diacritics from all authors (columns <code>microorganisms$ref</code> and <code>microorganisms.old$ref</code>) to comply with CRAN policy to only allow ASCII characters</li>
<li>Fix for <code>mo_property</code> not working properly</li>
<li>Fix for <code>eucast_rules</code> where some Streptococci would become ceftazidime R in EUCAST rule 4.5</li>
<li>Support for named vectors of class <code>mo</code>, useful for <code><a href="../reference/freq.html">top_freq()</a></code>
<li>Support for named vectors of class <code>mo</code>, useful for <code>top_freq()</code>
</li>
<li>
<code>ggplot_rsi</code> and <code>scale_y_percent</code> have <code>breaks</code> parameter</li>
@ -841,9 +841,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</ul>
</div>
</div>
<div id="amr-040" class="section level1">
<div id="amr-0-4-0" class="section level1">
<h1 class="page-header">
<a href="#amr-040" class="anchor"></a>AMR 0.4.0<small> 2018-10-01 </small>
<a href="#amr-0-4-0" class="anchor"></a>AMR 0.4.0<small> 2018-10-01 </small>
</h1>
<div id="new-5" class="section level4">
<h4 class="hasAnchor">
@ -862,18 +862,18 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
</ul>
<p>They also come with support for German, Dutch, French, Italian, Spanish and Portuguese:</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" title="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb18-2" title="2"><span class="co"># [1] "Gram negative"</span></a>
<a class="sourceLine" id="cb18-3" title="3"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
<a class="sourceLine" id="cb18-4" title="4"><span class="co"># [1] "Gramnegativ"</span></a>
<a class="sourceLine" id="cb18-5" title="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
<a class="sourceLine" id="cb18-6" title="6"><span class="co"># [1] "Gram negativo"</span></a>
<a class="sourceLine" id="cb18-7" title="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
<a class="sourceLine" id="cb18-8" title="8"><span class="co"># [1] "Streptococcus grupo A"</span></a></code></pre></div>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="co"># [1] "Gram negative"</span></a>
<a class="sourceLine" id="cb18-3" data-line-number="3"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"de"</span>) <span class="co"># German</span></a>
<a class="sourceLine" id="cb18-4" data-line-number="4"><span class="co"># [1] "Gramnegativ"</span></a>
<a class="sourceLine" id="cb18-5" data-line-number="5"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"E. coli"</span>, <span class="dt">language =</span> <span class="st">"es"</span>) <span class="co"># Spanish</span></a>
<a class="sourceLine" id="cb18-6" data-line-number="6"><span class="co"># [1] "Gram negativo"</span></a>
<a class="sourceLine" id="cb18-7" data-line-number="7"><span class="kw"><a href="../reference/mo_property.html">mo_fullname</a></span>(<span class="st">"S. group A"</span>, <span class="dt">language =</span> <span class="st">"pt"</span>) <span class="co"># Portuguese</span></a>
<a class="sourceLine" id="cb18-8" data-line-number="8"><span class="co"># [1] "Streptococcus grupo A"</span></a></code></pre></div>
<p>Furthermore, former taxonomic names will give a note about the current taxonomic name:</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" title="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)</a>
<a class="sourceLine" id="cb19-2" title="2"><span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span></a>
<a class="sourceLine" id="cb19-3" title="3"><span class="co"># [1] "Gram negative"</span></a></code></pre></div>
<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" data-line-number="1"><span class="kw"><a href="../reference/mo_property.html">mo_gramstain</a></span>(<span class="st">"Esc blattae"</span>)</a>
<a class="sourceLine" id="cb19-2" data-line-number="2"><span class="co"># Note: 'Escherichia blattae' (Burgess et al., 1973) was renamed 'Shimwellia blattae' (Priest and Barker, 2010)</span></a>
<a class="sourceLine" id="cb19-3" data-line-number="3"><span class="co"># [1] "Gram negative"</span></a></code></pre></div>
</li>
<li>Functions <code>count_R</code>, <code>count_IR</code>, <code>count_I</code>, <code>count_SI</code> and <code>count_S</code> to selectively count resistant or susceptible isolates
<ul>
@ -884,18 +884,18 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
<li>
<p>Functions <code>as.mo</code> and <code>is.mo</code> as replacements for <code>as.bactid</code> and <code>is.bactid</code> (since the <code>microoganisms</code> data set not only contains bacteria). These last two functions are deprecated and will be removed in a future release. The <code>as.mo</code> function determines microbial IDs using intelligent rules:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb20-2" title="2"><span class="co"># [1] B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb20-3" title="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>)</a>
<a class="sourceLine" id="cb20-4" title="4"><span class="co"># [1] B_STPHY_AUR</span></a>
<a class="sourceLine" id="cb20-5" title="5"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S group A"</span>)</a>
<a class="sourceLine" id="cb20-6" title="6"><span class="co"># [1] B_STRPTC_GRA</span></a></code></pre></div>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" data-line-number="1"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"E. coli"</span>)</a>
<a class="sourceLine" id="cb20-2" data-line-number="2"><span class="co"># [1] B_ESCHR_COL</span></a>
<a class="sourceLine" id="cb20-3" data-line-number="3"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"MRSA"</span>)</a>
<a class="sourceLine" id="cb20-4" data-line-number="4"><span class="co"># [1] B_STPHY_AUR</span></a>
<a class="sourceLine" id="cb20-5" data-line-number="5"><span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(<span class="st">"S group A"</span>)</a>
<a class="sourceLine" id="cb20-6" data-line-number="6"><span class="co"># [1] B_STRPTC_GRA</span></a></code></pre></div>
<p>And with great speed too - on a quite regular Linux server from 2007 it takes us less than 0.02 seconds to transform 25,000 items:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1">thousands_of_E_colis &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="st">"E. coli"</span>, <span class="dv">25000</span>)</a>
<a class="sourceLine" id="cb21-2" title="2">microbenchmark<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
<a class="sourceLine" id="cb21-3" title="3"><span class="co"># Unit: seconds</span></a>
<a class="sourceLine" id="cb21-4" title="4"><span class="co"># min median max neval</span></a>
<a class="sourceLine" id="cb21-5" title="5"><span class="co"># 0.01817717 0.01843957 0.03878077 100</span></a></code></pre></div>
<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" data-line-number="1">thousands_of_E_colis &lt;-<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/rep">rep</a></span>(<span class="st">"E. coli"</span>, <span class="dv">25000</span>)</a>
<a class="sourceLine" id="cb21-2" data-line-number="2">microbenchmark<span class="op">::</span><span class="kw"><a href="https://www.rdocumentation.org/packages/microbenchmark/topics/microbenchmark">microbenchmark</a></span>(<span class="kw"><a href="../reference/as.mo.html">as.mo</a></span>(thousands_of_E_colis), <span class="dt">unit =</span> <span class="st">"s"</span>)</a>
<a class="sourceLine" id="cb21-3" data-line-number="3"><span class="co"># Unit: seconds</span></a>
<a class="sourceLine" id="cb21-4" data-line-number="4"><span class="co"># min median max neval</span></a>
<a class="sourceLine" id="cb21-5" data-line-number="5"><span class="co"># 0.01817717 0.01843957 0.03878077 100</span></a></code></pre></div>
</li>
<li>Added parameter <code>reference_df</code> for <code>as.mo</code>, so users can supply their own microbial IDs, name or codes as a reference table</li>
<li>Renamed all previous references to <code>bactid</code> to <code>mo</code>, like:
@ -923,12 +923,12 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Added three antimicrobial agents to the <code>antibiotics</code> data set: Terbinafine (D01BA02), Rifaximin (A07AA11) and Isoconazole (D01AC05)</li>
<li>
<p>Added 163 trade names to the <code>antibiotics</code> data set, it now contains 298 different trade names in total, e.g.:</p>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" title="1"><span class="kw">ab_official</span>(<span class="st">"Bactroban"</span>)</a>
<a class="sourceLine" id="cb22-2" title="2"><span class="co"># [1] "Mupirocin"</span></a>
<a class="sourceLine" id="cb22-3" title="3"><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb22-4" title="4"><span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span></a>
<a class="sourceLine" id="cb22-5" title="5"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb22-6" title="6"><span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></a></code></pre></div>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" data-line-number="1"><span class="kw">ab_official</span>(<span class="st">"Bactroban"</span>)</a>
<a class="sourceLine" id="cb22-2" data-line-number="2"><span class="co"># [1] "Mupirocin"</span></a>
<a class="sourceLine" id="cb22-3" data-line-number="3"><span class="kw"><a href="../reference/ab_property.html">ab_name</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb22-4" data-line-number="4"><span class="co"># [1] "Mupirocin" "Amoxicillin" "Azithromycin" "Flucloxacillin"</span></a>
<a class="sourceLine" id="cb22-5" data-line-number="5"><span class="kw"><a href="../reference/ab_property.html">ab_atc</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(<span class="st">"Bactroban"</span>, <span class="st">"Amoxil"</span>, <span class="st">"Zithromax"</span>, <span class="st">"Floxapen"</span>))</a>
<a class="sourceLine" id="cb22-6" data-line-number="6"><span class="co"># [1] "R01AX06" "J01CA04" "J01FA10" "J01CF05"</span></a></code></pre></div>
</li>
<li>For <code>first_isolate</code>, rows will be ignored when theres no species available</li>
<li>Function <code>ratio</code> is now deprecated and will be removed in a future release, as it is not really the scope of this package</li>
@ -939,13 +939,13 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
<li>
<p>Support for quasiquotation in the functions series <code>count_*</code> and <code>portions_*</code>, and <code>n_rsi</code>. This allows to check for more than 2 vectors or columns.</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">select</span>(amox, cipr) <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>()</a>
<a class="sourceLine" id="cb23-2" title="2"><span class="co"># which is the same as:</span></a>
<a class="sourceLine" id="cb23-3" title="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>(amox, cipr)</a>
<a class="sourceLine" id="cb23-4" title="4"></a>
<a class="sourceLine" id="cb23-5" title="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl)</a>
<a class="sourceLine" id="cb23-6" title="6">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent)</a>
<a class="sourceLine" id="cb23-7" title="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent, pita)</a></code></pre></div>
<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" data-line-number="1">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">select</span>(amox, cipr) <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>()</a>
<a class="sourceLine" id="cb23-2" data-line-number="2"><span class="co"># which is the same as:</span></a>
<a class="sourceLine" id="cb23-3" data-line-number="3">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/count.html">count_IR</a></span>(amox, cipr)</a>
<a class="sourceLine" id="cb23-4" data-line-number="4"></a>
<a class="sourceLine" id="cb23-5" data-line-number="5">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl)</a>
<a class="sourceLine" id="cb23-6" data-line-number="6">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent)</a>
<a class="sourceLine" id="cb23-7" data-line-number="7">septic_patients <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/portion.html">portion_S</a></span>(amcl, gent, pita)</a></code></pre></div>
</li>
<li>Edited <code>ggplot_rsi</code> and <code>geom_rsi</code> so they can cope with <code>count_df</code>. The new <code>fun</code> parameter has value <code>portion_df</code> at default, but can be set to <code>count_df</code>.</li>
<li>Fix for <code>ggplot_rsi</code> when the <code>ggplot2</code> package was not loaded</li>
@ -959,12 +959,12 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
<li>
<p>Support for types (classes) list and matrix for <code>freq</code></p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">my_matrix =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/with">with</a></span>(septic_patients, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(age, gender), <span class="dt">ncol =</span> <span class="dv">2</span>))</a>
<a class="sourceLine" id="cb24-2" title="2"><span class="kw"><a href="../reference/freq.html">freq</a></span>(my_matrix)</a></code></pre></div>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" data-line-number="1">my_matrix =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/with">with</a></span>(septic_patients, <span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/matrix">matrix</a></span>(<span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/c">c</a></span>(age, gender), <span class="dt">ncol =</span> <span class="dv">2</span>))</a>
<a class="sourceLine" id="cb24-2" data-line-number="2"><span class="kw">freq</span>(my_matrix)</a></code></pre></div>
<p>For lists, subsetting is possible:</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1">my_list =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/list">list</a></span>(<span class="dt">age =</span> septic_patients<span class="op">$</span>age, <span class="dt">gender =</span> septic_patients<span class="op">$</span>gender)</a>
<a class="sourceLine" id="cb25-2" title="2">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(age)</a>
<a class="sourceLine" id="cb25-3" title="3">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw"><a href="../reference/freq.html">freq</a></span>(gender)</a></code></pre></div>
<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" data-line-number="1">my_list =<span class="st"> </span><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/list">list</a></span>(<span class="dt">age =</span> septic_patients<span class="op">$</span>age, <span class="dt">gender =</span> septic_patients<span class="op">$</span>gender)</a>
<a class="sourceLine" id="cb25-2" data-line-number="2">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">freq</span>(age)</a>
<a class="sourceLine" id="cb25-3" data-line-number="3">my_list <span class="op">%&gt;%</span><span class="st"> </span><span class="kw">freq</span>(gender)</a></code></pre></div>
</li>
</ul>
</div>
@ -976,9 +976,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</ul>
</div>
</div>
<div id="amr-030" class="section level1">
<div id="amr-0-3-0" class="section level1">
<h1 class="page-header">
<a href="#amr-030" class="anchor"></a>AMR 0.3.0<small> 2018-08-14 </small>
<a href="#amr-0-3-0" class="anchor"></a>AMR 0.3.0<small> 2018-08-14 </small>
</h1>
<div id="new-6" class="section level4">
<h4 class="hasAnchor">
@ -1038,13 +1038,13 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<ul>
<li>A vignette to explain its usage</li>
<li>Support for <code>rsi</code> (antimicrobial resistance) to use as input</li>
<li>Support for <code>table</code> to use as input: <code><a href="../reference/freq.html">freq(table(x, y))</a></code>
<li>Support for <code>table</code> to use as input: <code>freq(table(x, y))</code>
</li>
<li>Support for existing functions <code>hist</code> and <code>plot</code> to use a frequency table as input: <code><a href="https://www.rdocumentation.org/packages/graphics/topics/hist">hist(freq(df$age))</a></code>
</li>
<li>Support for <code>as.vector</code>, <code>as.data.frame</code>, <code>as_tibble</code> and <code>format</code>
</li>
<li>Support for quasiquotation: <code><a href="../reference/freq.html">freq(mydata, mycolumn)</a></code> is the same as <code>mydata %&gt;% freq(mycolumn)</code>
<li>Support for quasiquotation: <code>freq(mydata, mycolumn)</code> is the same as <code>mydata %&gt;% freq(mycolumn)</code>
</li>
<li>Function <code>top_freq</code> function to return the top/below <em>n</em> items as vector</li>
<li>Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)</li>
@ -1083,7 +1083,7 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</li>
</ul>
</li>
<li>Now possible to coerce MIC values with a space between operator and value, i.e. <code><a href="../reference/as.mic.html">as.mic("&lt;= 0.002")</a></code> now works</li>
<li>Now possible to coerce MIC values with a space between operator and value, i.e. <code><a href="../reference/as.mic.html">as.mic("&lt;= 0.002")</a></code> now works</li>
<li>Classes <code>rsi</code> and <code>mic</code> do not add the attribute <code>package.version</code> anymore</li>
<li>Added <code>"groups"</code> option for <code>atc_property(..., property)</code>. It will return a vector of the ATC hierarchy as defined by the <a href="https://www.whocc.no/atc/structure_and_principles/">WHO</a>. The new function <code>atc_groups</code> is a convenient wrapper around this.</li>
<li>Build-in host check for <code>atc_property</code> as it requires the host set by <code>url</code> to be responsive</li>
@ -1113,9 +1113,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</ul>
</div>
</div>
<div id="amr-020" class="section level1">
<div id="amr-0-2-0" class="section level1">
<h1 class="page-header">
<a href="#amr-020" class="anchor"></a>AMR 0.2.0<small> 2018-05-03 </small>
<a href="#amr-0-2-0" class="anchor"></a>AMR 0.2.0<small> 2018-05-03 </small>
</h1>
<div id="new-7" class="section level4">
<h4 class="hasAnchor">
@ -1171,9 +1171,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
</ul>
</div>
</div>
<div id="amr-011" class="section level1">
<div id="amr-0-1-1" class="section level1">
<h1 class="page-header">
<a href="#amr-011" class="anchor"></a>AMR 0.1.1<small> 2018-03-14 </small>
<a href="#amr-0-1-1" class="anchor"></a>AMR 0.1.1<small> 2018-03-14 </small>
</h1>
<ul>
<li>
@ -1184,9 +1184,9 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<li>Added barplots for <code>rsi</code> and <code>mic</code> classes</li>
</ul>
</div>
<div id="amr-010" class="section level1">
<div id="amr-0-1-0" class="section level1">
<h1 class="page-header">
<a href="#amr-010" class="anchor"></a>AMR 0.1.0<small> 2018-02-22 </small>
<a href="#amr-0-1-0" class="anchor"></a>AMR 0.1.0<small> 2018-02-22 </small>
</h1>
<ul>
<li>First submission to CRAN.</li>
@ -1198,17 +1198,17 @@ Using <code><a href="../reference/as.mo.html">as.mo(..., allow_uncertain = 3)</a
<div id="tocnav">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#amr-0719013">0.7.1.9013</a></li>
<li><a href="#amr-071">0.7.1</a></li>
<li><a href="#amr-070">0.7.0</a></li>
<li><a href="#amr-061">0.6.1</a></li>
<li><a href="#amr-060">0.6.0</a></li>
<li><a href="#amr-050">0.5.0</a></li>
<li><a href="#amr-040">0.4.0</a></li>
<li><a href="#amr-030">0.3.0</a></li>
<li><a href="#amr-020">0.2.0</a></li>
<li><a href="#amr-011">0.1.1</a></li>
<li><a href="#amr-010">0.1.0</a></li>
<li><a href="#amr-0-7-1-9017">0.7.1.9017</a></li>
<li><a href="#amr-0-7-1">0.7.1</a></li>
<li><a href="#amr-0-7-0">0.7.0</a></li>
<li><a href="#amr-0-6-1">0.6.1</a></li>
<li><a href="#amr-0-6-0">0.6.0</a></li>
<li><a href="#amr-0-5-0">0.5.0</a></li>
<li><a href="#amr-0-4-0">0.4.0</a></li>
<li><a href="#amr-0-3-0">0.3.0</a></li>
<li><a href="#amr-0-2-0">0.2.0</a></li>
<li><a href="#amr-0-1-1">0.1.1</a></li>
<li><a href="#amr-0-1-0">0.1.0</a></li>
</ul>
</div>
</div>

View File

@ -1,4 +1,4 @@
pandoc: '2.6'
pandoc: 2.3.1
pkgdown: 1.3.0
pkgdown_sha: ~
articles:
@ -8,7 +8,6 @@ articles:
SPSS: SPSS.html
WHONET: WHONET.html
benchmarks: benchmarks.html
freq: freq.html
resistance_predict: resistance_predict.html
urls:
reference: https://msberends.gitlab.io/AMR/reference

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9016</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -296,7 +289,9 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>mic_data</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>mic_data</span>)
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>mic_data</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>clean</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/clean/topics/freq'>freq</a></span>(<span class='no'>mic_data</span>)
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9016</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -343,7 +336,9 @@
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/plot'>plot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for percentages</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/graphics/topics/barplot'>barplot</a></span>(<span class='no'>rsi_data</span>) <span class='co'># for frequencies</span>
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>rsi_data</span>) <span class='co'># frequency table with informative header</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>clean</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/clean/topics/freq'>freq</a></span>(<span class='no'>rsi_data</span>) <span class='co'># frequency table with informative header</span>
<span class='co'># using dplyr's mutate</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9017</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -271,8 +264,9 @@ This package contains the complete taxonomic tree of almost all microorganisms (
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># NOT RUN {</span>
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>dplyr</span>)
<span class='no'>microorganisms</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>kingdom</span>)
<span class='no'>microorganisms</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>kingdom</span>) <span class='kw'>%&gt;%</span> <span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>phylum</span>, <span class='kw'>nmax</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)
<span class='fu'><a href='https://www.rdocumentation.org/packages/base/topics/library'>library</a></span>(<span class='no'>clean</span>)
<span class='no'>microorganisms</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/clean/topics/freq'>freq</a></span>(<span class='no'>kingdom</span>)
<span class='no'>microorganisms</span> <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='no'>kingdom</span>) <span class='kw'>%&gt;%</span> <span class='fu'><a href='https://www.rdocumentation.org/packages/clean/topics/freq'>freq</a></span>(<span class='no'>phylum</span>, <span class='kw'>nmax</span> <span class='kw'>=</span> <span class='kw'>NULL</span>)
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -81,7 +81,7 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -159,13 +159,6 @@ count_R and count_IR can be used to count resistant isolates, count_S and count_
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -457,7 +450,7 @@
<span class='co'># create new bacterial ID's, with all CoNS under the same group (Becker et al.)</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>mo</span> <span class='kw'>=</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='no'>mo</span>, <span class='kw'>Becker</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># filter on top three bacterial ID's</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'><a href='freq.html'>top_freq</a></span>(<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>%in%</span> <span class='fu'>top_freq</span>(<span class='fu'>freq</span>(<span class='no'>.</span>$<span class='no'>mo</span>), <span class='fl'>3</span>)) <span class='kw'>%&gt;%</span>
<span class='co'># filter on first isolates</span>
<span class='fu'><a href='first_isolate.html'>filter_first_isolate</a></span>() <span class='kw'>%&gt;%</span>
<span class='co'># get short MO names (like "E. coli")</span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -78,7 +78,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9013</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9017</span>
</span>
</div>
@ -156,13 +156,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -411,7 +404,7 @@
<tr>
<th colspan="2">
<h2 id="section-analysing-your-data" class="hasAnchor"><a href="#section-analysing-your-data" class="anchor"></a>Analysing your data</h2>
<p class="section-desc"><p>Functions for conducting AMR analysis, like counting isolates, calculating resistance or susceptibility, creating frequency tables or make plots.</p></p>
<p class="section-desc"><p>Functions for conducting AMR analysis, like counting isolates, calculating resistance or susceptibility, or make plots.</p></p>
</th>
</tr>
<tr>
@ -440,12 +433,6 @@
<td><p>Filter isolates on result in antibiotic class</p></td>
</tr><tr>
<td>
<p><code><a href="freq.html">freq()</a></code> <code><a href="freq.html">frequency_tbl()</a></code> <code><a href="freq.html">top_freq()</a></code> <code><a href="freq.html">header()</a></code> <code><a href="freq.html">print(<i>&lt;freq&gt;</i>)</a></code> </p>
</td>
<td><p>Frequency table</p></td>
</tr><tr>
<td>
<p><code><a href="g.test.html">g.test()</a></code> </p>
</td>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>
@ -309,7 +302,7 @@
<span class='no'>septic_patients</span> <span class='kw'>%&gt;%</span>
<span class='fu'><a href='join.html'>left_join_microorganisms</a></span>() <span class='kw'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>genus</span> <span class='kw'>%like%</span> <span class='st'>'^ent'</span>) <span class='kw'>%&gt;%</span>
<span class='fu'><a href='freq.html'>freq</a></span>(<span class='no'>genus</span>, <span class='no'>species</span>)
<span class='fu'>freq</span>(<span class='no'>genus</span>, <span class='no'>species</span>)
<span class='co'># }</span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9009</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -81,7 +81,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -159,13 +159,6 @@ This is the fastest way to have your organisation (or analysis) specific codes p
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -81,7 +81,7 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -159,13 +159,6 @@ portion_R and portion_IR can be used to calculate resistance, portion_S and port
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -81,7 +81,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -159,13 +159,6 @@ When negative: the left tail is longer; the mass of the distribution is concentr
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -80,7 +80,7 @@
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9012</span>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">0.7.1.9015</span>
</span>
</div>
@ -158,13 +158,6 @@
Get properties of an antibiotic
</a>
</li>
<li>
<a href="../articles/freq.html">
<span class="fa fa-sort-amount-down"></span>
Create frequency tables
</a>
</li>
<li>
<a href="../articles/benchmarks.html">
<span class="fa fa-shipping-fast"></span>

View File

@ -69,9 +69,6 @@
<url>
<loc>https://msberends.gitlab.io/AMR/reference/first_isolate.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/reference/freq.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/reference/g.test.html</loc>
</url>
@ -153,9 +150,6 @@
<url>
<loc>https://msberends.gitlab.io/AMR/articles/benchmarks.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/articles/freq.html</loc>
</url>
<url>
<loc>https://msberends.gitlab.io/AMR/articles/resistance_predict.html</loc>
</url>

View File

@ -36,6 +36,7 @@ fi
sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION
# update 1st line of NEWS.md
sed -i -- "1s/.*/# AMR ${new_version}/" NEWS.md
rm *--
echo "• First 3 lines of DESCRIPTION:"
head -3 DESCRIPTION
echo

View File

@ -26,7 +26,6 @@ This package can be used for:
* Plotting antimicrobial resistance ([tutorial](./articles/AMR.html))
* Determining first isolates to be used for AMR analysis ([manual](./reference/first_isolate.html))
* Applying EUCAST expert rules ([manual](./reference/eucast_rules.html))
* Descriptive statistics: frequency tables, kurtosis and skewness ([tutorial](./articles/freq.html))
This package is ready-to-use for a professional environment by specialists in the following fields:
@ -154,7 +153,6 @@ The `AMR` package basically does four important things:
* Calculate the resistance (and even co-resistance) of microbial isolates with the `portion_R()`, `portion_IR()`, `portion_I()`, `portion_SI()` and `portion_S()` functions. Similarly, the *number* of isolates can be determined with the `count_R()`, `count_IR()`, `count_I()`, `count_SI()` and `count_S()` functions. All these functions can be used with the `dplyr` package (e.g. in conjunction with `summarise()`)
* Plot AMR results with `geom_rsi()`, a function made for the `ggplot2` package
* Predict antimicrobial resistance for the nextcoming years using logistic regression models with the `resistance_predict()` function
* Conduct descriptive statistics to enhance base R: calculate `kurtosis()`, `skewness()` and create frequency tables with `freq()`
4. It **teaches the user** how to use all the above actions.

View File

@ -47,6 +47,8 @@ as.rsi(x = as.mic(4),
plot(mic_data)
barplot(mic_data)
library(clean)
freq(mic_data)
}
\seealso{

View File

@ -90,6 +90,8 @@ as.rsi(x = as.mic(4),
plot(rsi_data) # for percentages
barplot(rsi_data) # for frequencies
library(clean)
freq(rsi_data) # frequency table with informative header
# using dplyr's mutate

View File

@ -30,6 +30,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
\examples{
library(dplyr)
library(clean)
microorganisms \%>\% freq(kingdom)
microorganisms \%>\% group_by(kingdom) \%>\% freq(phylum, nmax = NULL)
}

View File

@ -1,234 +0,0 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/freq.R
\name{freq}
\alias{freq}
\alias{frequency_tbl}
\alias{top_freq}
\alias{header}
\alias{print.freq}
\title{Frequency table}
\usage{
freq(x, ..., sort.count = TRUE, nmax = getOption("max.print.freq"),
na.rm = TRUE, row.names = TRUE, markdown = !interactive(),
digits = 2, quote = NULL, header = TRUE, title = NULL,
na = "<NA>", droplevels = TRUE, sep = " ",
decimal.mark = getOption("OutDec"), big.mark = ifelse(decimal.mark !=
",", ",", "."))
frequency_tbl(x, ..., sort.count = TRUE,
nmax = getOption("max.print.freq"), na.rm = TRUE, row.names = TRUE,
markdown = !interactive(), digits = 2, quote = NULL,
header = TRUE, title = NULL, na = "<NA>", droplevels = TRUE,
sep = " ", decimal.mark = getOption("OutDec"),
big.mark = ifelse(decimal.mark != ",", ",", "."))
top_freq(f, n)
header(f, property = NULL)
\method{print}{freq}(x, nmax = getOption("max.print.freq", default = 15),
markdown = !interactive(), header = TRUE,
decimal.mark = getOption("OutDec"), big.mark = ifelse(decimal.mark !=
",", ",", "."), ...)
}
\arguments{
\item{x}{vector of any class or a \code{\link{data.frame}}, \code{\link{tibble}} (may contain a grouping variable) or \code{\link{table}}}
\item{...}{up to nine different columns of \code{x} when \code{x} is a \code{data.frame} or \code{tibble}, to calculate frequencies from - see Examples. Also supports quasiquotion.}
\item{sort.count}{sort on count, i.e. frequencies. This will be \code{TRUE} at default for everything except when using grouping variables.}
\item{nmax}{number of row to print. The default, \code{15}, uses \code{\link{getOption}("max.print.freq")}. Use \code{nmax = 0}, \code{nmax = Inf}, \code{nmax = NULL} or \code{nmax = NA} to print all rows.}
\item{na.rm}{a logical value indicating whether \code{NA} values should be removed from the frequency table. The header (if set) will always print the amount of \code{NA}s.}
\item{row.names}{a logical value indicating whether row indices should be printed as \code{1:nrow(x)}}
\item{markdown}{a logical value indicating whether the frequency table should be printed in markdown format. This will print all rows (except when \code{nmax} is defined) and is default behaviour in non-interactive R sessions (like when knitting RMarkdown files).}
\item{digits}{how many significant digits are to be used for numeric values in the header (not for the items themselves, that depends on \code{\link{getOption}("digits")})}
\item{quote}{a logical value indicating whether or not strings should be printed with surrounding quotes. Default is to print them only around characters that are actually numeric values.}
\item{header}{a logical value indicating whether an informative header should be printed}
\item{title}{text to show above frequency table, at default to tries to coerce from the variables passed to \code{x}}
\item{na}{a character string that should be used to show empty (\code{NA}) values (only useful when \code{na.rm = FALSE})}
\item{droplevels}{a logical value indicating whether in factors empty levels should be dropped}
\item{sep}{a character string to separate the terms when selecting multiple columns}
\item{decimal.mark}{%
used for prettying (longish) numerical and complex sequences.
Passed to \code{\link{prettyNum}}: that help page explains the details.}
\item{big.mark}{%
used for prettying (longish) numerical and complex sequences.
Passed to \code{\link{prettyNum}}: that help page explains the details.}
\item{f}{a frequency table}
\item{n}{number of top \emph{n} items to return, use -n for the bottom \emph{n} items. It will include more than \code{n} rows if there are ties.}
\item{property}{property in header to return this value directly}
}
\value{
A \code{data.frame} (with an additional class \code{"freq"}) with five columns: \code{item}, \code{count}, \code{percent}, \code{cum_count} and \code{cum_percent}.
}
\description{
Create a frequency table of a vector with items or a \code{data.frame}. Supports quasiquotation and markdown for reports. Best practice is: \code{data \%>\% freq(var)}.\cr
\code{top_freq} can be used to get the top/bottom \emph{n} items of a frequency table, with counts as names.
}
\details{
Frequency tables (or frequency distributions) are summaries of the distribution of values in a sample. With the `freq` function, you can create univariate frequency tables. Multiple variables will be pasted into one variable, so it forces a univariate distribution. This package also has a vignette available to explain the use of this function further, run \code{browseVignettes("AMR")} to read it.
For numeric values of any class, these additional values will all be calculated with \code{na.rm = TRUE} and shown into the header:
\itemize{
\item{Mean, using \code{\link[base]{mean}}}
\item{Standard Deviation, using \code{\link[stats]{sd}}}
\item{Coefficient of Variation (CV), the standard deviation divided by the mean}
\item{Mean Absolute Deviation (MAD), using \code{\link[stats]{mad}}}
\item{Tukey Five-Number Summaries (minimum, Q1, median, Q3, maximum), using \code{\link[stats]{fivenum}}}
\item{Interquartile Range (IQR) calculated as \code{Q3 - Q1} using the Tukey Five-Number Summaries, i.e. \strong{not} using the \code{\link[stats]{quantile}} function}
\item{Coefficient of Quartile Variation (CQV, sometimes called coefficient of dispersion), calculated as \code{(Q3 - Q1) / (Q3 + Q1)} using the Tukey Five-Number Summaries}
\item{Outliers (total count and unique count), using \code{\link[grDevices]{boxplot.stats}}}
}
For dates and times of any class, these additional values will be calculated with \code{na.rm = TRUE} and shown into the header:
\itemize{
\item{Oldest, using \code{\link{min}}}
\item{Newest, using \code{\link{max}}, with difference between newest and oldest}
\item{Median, using \code{\link[stats]{median}}, with percentage since oldest}
}
In factors, all factor levels that are not existing in the input data will be dropped.
The function \code{top_freq} uses \code{\link[dplyr]{top_n}} internally and will include more than \code{n} rows if there are ties.
}
\section{Read more on our website!}{
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
}
\examples{
library(dplyr)
# this all gives the same result:
freq(septic_patients$hospital_id)
freq(septic_patients[, "hospital_id"])
septic_patients$hospital_id \%>\% freq()
septic_patients[, "hospital_id"] \%>\% freq()
septic_patients \%>\% freq("hospital_id")
septic_patients \%>\% freq(hospital_id) #<- easiest to remember (tidyverse)
# you could also use `select` or `pull` to get your variables
septic_patients \%>\%
filter(hospital_id == "A") \%>\%
select(mo) \%>\%
freq()
# multiple selected variables will be pasted together
septic_patients \%>\%
left_join_microorganisms \%>\%
freq(genus, species)
# functions as quasiquotation are also supported
septic_patients \%>\%
freq(mo_genus(mo), mo_species(mo))
# group a variable and analyse another
septic_patients \%>\%
group_by(hospital_id) \%>\%
freq(gender)
# get top 10 bugs of hospital A as a vector
septic_patients \%>\%
filter(hospital_id == "A") \%>\%
freq(mo) \%>\%
top_freq(10)
# save frequency table to an object
years <- septic_patients \%>\%
mutate(year = format(date, "\%Y")) \%>\%
freq(year)
# show only the top 5
years \%>\% print(nmax = 5)
# save to an object with formatted percentages
years <- format(years)
# print a histogram of numeric values
septic_patients \%>\%
freq(age) \%>\%
hist()
# or a boxplot of numeric values
septic_patients \%>\%
freq(age) \%>\%
boxplot()
# or even a boxplot per group
septic_patients \%>\%
group_by(hospital_id) \%>\%
freq(age) \%>\%
boxplot()
# or print all points to a regular plot
septic_patients \%>\%
freq(age) \%>\%
plot()
# transform to a data.frame or tibble
septic_patients \%>\%
freq(age) \%>\%
as.data.frame()
# or transform (back) to a vector
septic_patients \%>\%
freq(age) \%>\%
as.vector()
identical(septic_patients \%>\%
freq(age) \%>\%
as.vector() \%>\%
sort(),
sort(septic_patients$age)) # TRUE
# it also supports `table` objects
table(septic_patients$gender,
septic_patients$age) \%>\%
freq(sep = " **sep** ")
# only get selected columns
septic_patients \%>\%
freq(hospital_id) \%>\%
select(item, percent)
septic_patients \%>\%
freq(hospital_id) \%>\%
select(-count, -cum_count)
# check differences between frequency tables
diff(freq(septic_patients$TMP),
freq(septic_patients$SXT))
}
\keyword{freq}
\keyword{frequency}
\keyword{summarise}
\keyword{summary}

View File

@ -22,168 +22,10 @@
context("freq.R")
test_that("frequency table works", {
library(dplyr)
expect_equal(nrow(freq(c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5))), 5)
expect_equal(nrow(frequency_tbl(c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5))), 5)
# date column of septic_patients should contain 1140 unique dates
expect_equal(nrow(freq(septic_patients$date)), 1140)
expect_equal(nrow(freq(septic_patients$date)),
length(unique(septic_patients$date)))
expect_output(print(septic_patients %>% freq(age)))
expect_output(print(septic_patients %>% freq(age, nmax = 5)))
expect_output(print(septic_patients %>% freq(age, nmax = Inf, markdown = FALSE)))
expect_output(print(freq(septic_patients$age, nmax = Inf)))
expect_output(print(freq(septic_patients$age, nmax = NA)))
expect_output(print(freq(septic_patients$age, nmax = NULL)))
expect_output(print(freq(septic_patients$age, sort.count = FALSE)))
expect_output(print(freq(septic_patients$age, markdown = TRUE)))
expect_output(print(freq(septic_patients$age, markdown = TRUE), markdown = FALSE))
expect_output(print(freq(septic_patients$age, markdown = TRUE), markdown = TRUE))
expect_output(print(freq(septic_patients$age[0])))
expect_output(print(freq(septic_patients$age, quote = TRUE)))
expect_output(print(freq(septic_patients$age, markdown = TRUE, title = "TITLE")))
# character
expect_output(print(freq(microorganisms$genus)))
expect_output(print(structure(freq(microorganisms$genus),
# check printing of old class:
class = c("frequency_tbl", "data.frame"))))
library(clean)
# mo
expect_output(print(freq(septic_patients$mo)))
# rsi
expect_output(print(freq(septic_patients$AMX)))
# integer
expect_output(print(freq(septic_patients$age)))
# date
expect_output(print(freq(septic_patients$date)))
# factor
expect_output(print(freq(septic_patients$hospital_id)))
# table
expect_output(print(freq(table(septic_patients$gender, septic_patients$age))))
# rsi
expect_output(print(freq(septic_patients$AMC)))
# hms
expect_output(print(freq(hms::as.hms(sample(c(0:86399), 50)))))
# matrix
expect_output(print(freq(as.matrix(septic_patients$age))))
expect_output(print(freq(as.matrix(septic_patients[, c("age", "gender")]))))
# list
expect_output(print(freq(list(age = septic_patients$age))))
expect_output(print(freq(list(age = septic_patients$age, gender = septic_patients$gender))))
# difftime
expect_output(print(
freq(difftime(Sys.time(),
Sys.time() - runif(5, min = 0, max = 60 * 60 * 24),
units = "hours"))))
expect_output(print(freq(septic_patients$age)[,1:3]))
library(dplyr)
expect_output(septic_patients %>% select(1:2) %>% freq() %>% print())
expect_output(septic_patients %>% select(1:3) %>% freq() %>% print())
expect_output(septic_patients %>% select(1:4) %>% freq() %>% print())
expect_output(septic_patients %>% select(1:5) %>% freq() %>% print())
expect_output(septic_patients %>% select(1:6) %>% freq() %>% print())
expect_output(septic_patients %>% select(1:7) %>% freq() %>% print())
expect_output(septic_patients %>% select(1:8) %>% freq() %>% print())
expect_output(septic_patients %>% select(1:9) %>% freq() %>% print())
expect_output(print(freq(septic_patients$age), nmax = 20))
# grouping variable
expect_output(print(septic_patients %>% group_by(gender) %>% freq(hospital_id)))
expect_output(print(septic_patients %>% group_by(gender) %>% freq(AMX, quote = TRUE)))
expect_output(print(septic_patients %>% group_by(gender) %>% freq(AMX, markdown = TRUE)))
# quasiquotation
expect_output(print(septic_patients %>% freq(mo_genus(mo))))
expect_output(print(septic_patients %>% freq(mo, mo_genus(mo))))
expect_output(print(septic_patients %>% group_by(gender) %>% freq(mo_genus(mo))))
expect_output(print(septic_patients %>% group_by(gender) %>% freq(mo, mo_genus(mo))))
# top 5
expect_equal(
septic_patients %>%
freq(mo) %>%
top_freq(5) %>%
length(),
5)
# there are more than 5 lowest values
expect_gt(
septic_patients %>%
freq(mo) %>%
top_freq(-5) %>%
length(),
5)
# n has length > 1
expect_error(
septic_patients %>%
freq(mo) %>%
top_freq(n = c(1, 2))
)
# input must be freq tbl
expect_error(septic_patients %>% top_freq(1))
# charts from plot, hist and boxplot, should not raise errors
plot(freq(septic_patients, age))
hist(freq(septic_patients, age))
boxplot(freq(septic_patients, age))
boxplot(freq(dplyr::group_by(septic_patients, gender), age))
# check vector
expect_identical(septic_patients %>%
freq(age) %>%
as.vector() %>%
sort(),
septic_patients %>%
pull(age) %>%
sort())
# check format
expect_identical(septic_patients %>%
freq(age) %>%
format() %>%
apply(2, class) %>%
unname(),
rep("character", 5))
# check tibble
expect_identical(septic_patients %>%
freq(age) %>%
as_tibble() %>%
class() %>%
.[1],
"tbl_df")
expect_error(septic_patients %>% freq(nonexisting))
expect_error(septic_patients %>% select(1:10) %>% freq())
expect_error(septic_patients %>% freq(peni, oxac, clox, AMX, AMC,
ampi, pita, czol, cfep, cfur))
# (un)select columns
expect_equal(septic_patients %>% freq(hospital_id) %>% select(item) %>% ncol(),
1)
expect_equal(septic_patients %>% freq(hospital_id) %>% select(-item) %>% ncol(),
4)
# run diff
expect_output(print(
diff(freq(septic_patients$AMC),
freq(septic_patients$AMX))
))
expect_output(print(
diff(freq(septic_patients$age),
freq(septic_patients$age)) # "No differences found."
))
expect_error(print(
diff(freq(septic_patients$AMX),
"Just a string") # not a freq tbl
))
# directly on group
expect_output(print(septic_patients %>% group_by(ageplusone = as.character(age + 1)) %>% freq(ageplusone)))
})

View File

@ -144,7 +144,14 @@ knitr::kable(head(data), align = "c")
Now, let's start the cleaning and the analysis!
# Cleaning the data
Use the frequency table function `freq()` to look specifically for unique values in any variable. For example, for the `gender` variable:
We also created a package dedicated to data cleaning and checking, called the `clean` package. It gets automatically installed with the `AMR` package, so we only have to load it:
```{r lib clean, message = FALSE}
library(clean)
```
Use the frequency table function `freq()` from this `clean` package to look specifically for unique values in any variable. For example, for the `gender` variable:
```{r freq gender 1, eval = FALSE}
data %>% freq(gender) # this would be the same: freq(data$gender)

View File

@ -72,7 +72,13 @@ We can now add the interpretation of MDR-TB to our data set:
my_TB_data$mdr <- mdr_tb(my_TB_data)
```
And review the result with a frequency table:
We also created a package dedicated to data cleaning and checking, called the `clean` package. It gets automatically installed with the `AMR` package, so we only have to load it:
```{r lib clean, message = FALSE}
library(clean)
```
It contains the `freq()` function, to create a frequency table:
```{r, results = 'asis'}
freq(my_TB_data$mdr)

View File

@ -60,7 +60,17 @@ data <- WHONET %>%
mutate_at(vars(AMP_ND10:CIP_EE), as.rsi)
```
No errors or warnings, so all values are transformed succesfully. Let's check it though, with a couple of frequency tables:
No errors or warnings, so all values are transformed succesfully.
We created a package dedicated to data cleaning and checking, called the `clean` package. It gets automatically installed with the `AMR` package, so we only have to load it:
```{r lib clean, message = FALSE}
library(clean)
```
It contains the `freq()` function, to create frequency tables.
So let's check our data, with a couple of frequency tables:
```{r, results = 'asis'}
# our newly created `mo` variable

View File

@ -1,182 +0,0 @@
---
title: "How to create frequency tables"
author: "Matthijs S. Berends"
date: '`r format(Sys.Date(), "%d %B %Y")`'
output:
rmarkdown::html_vignette:
toc: true
toc_depth: 3
vignette: >
%\VignetteIndexEntry{How to create frequency tables}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---
```{r setup, include = FALSE, results = 'asis'}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#",
results = 'asis',
fig.width = 7.5,
fig.height = 4.5
)
library(dplyr)
library(AMR)
```
## Introduction
Frequency tables (or frequency distributions) are summaries of the distribution of values in a sample. With the `freq()` function, you can create univariate frequency tables. Multiple variables will be pasted into one variable, so it forces a univariate distribution. We take the `septic_patients` dataset (included in this AMR package) as example.
## Frequencies of one variable
To only show and quickly review the content of one variable, you can just select this variable in various ways. Let's say we want to get the frequencies of the `gender` variable of the `septic_patients` dataset:
```{r, echo = TRUE}
# Any of these will work:
# freq(septic_patients$gender)
# freq(septic_patients[, "gender"])
# Using tidyverse:
# septic_patients$gender %>% freq()
# septic_patients[, "gender"] %>% freq()
# septic_patients %>% freq("gender")
# Probably the fastest and easiest:
septic_patients %>% freq(gender)
```
This immediately shows the class of the variable, its length and availability (i.e. the amount of `NA`), the amount of unique values and (most importantly) that among septic patients men are more prevalent than women.
## Frequencies of more than one variable
Multiple variables will be pasted into one variable to review individual cases, keeping a univariate frequency table.
For illustration, we could add some more variables to the `septic_patients` dataset to learn about bacterial properties:
```{r, echo = TRUE, results = 'hide'}
my_patients <- septic_patients %>% left_join_microorganisms()
```
Now all variables of the `microorganisms` dataset have been joined to the `septic_patients` dataset. The `microorganisms` dataset consists of the following variables:
```{r, echo = TRUE, results = 'markup'}
colnames(microorganisms)
```
If we compare the dimensions between the old and new dataset, we can see that these `r ncol(my_patients) - ncol(septic_patients)` variables were added:
```{r, echo = TRUE, results = 'markup'}
dim(septic_patients)
dim(my_patients)
```
So now the `genus` and `species` variables are available. A frequency table of these combined variables can be created like this:
```{r, echo = TRUE}
my_patients %>%
freq(genus, species, nmax = 15)
```
## Frequencies of numeric values
Frequency tables can be created of any input.
In case of numeric values (like integers, doubles, etc.) additional descriptive statistics will be calculated and shown into the header:
```{r, echo = TRUE}
# # get age distribution of unique patients
septic_patients %>%
distinct(patient_id, .keep_all = TRUE) %>%
freq(age, nmax = 5, header = TRUE)
```
So the following properties are determined, where `NA` values are always ignored:
* **Mean**
* **Standard deviation**
* **Coefficient of variation** (CV), the standard deviation divided by the mean
* **Mean absolute deviation** (MAD), the median of the absolute deviations from the median - a more robust statistic than the standard deviation
* **Five numbers of Tukey**, namely: the minimum, Q1, median, Q3 and maximum
* **Interquartile range** (IQR), the distance between Q1 and Q3
* **Coefficient of quartile variation** (CQV, sometimes called *coefficient of dispersion*), calculated as (Q3 - Q1) / (Q3 + Q1) using `quantile()` with `type = 6` as quantile algorithm to comply with SPSS standards
* **Outliers** (total count and unique count)
So for example, the above frequency table quickly shows the median age of patients being `r my_patients %>% distinct(patient_id, .keep_all = TRUE) %>% pull(age) %>% median(na.rm = TRUE)`.
## Frequencies of factors
To sort frequencies of factors on their levels instead of item count, use the `sort.count` parameter.
`sort.count` is `TRUE` by default. Compare this default behaviour...
```{r, echo = TRUE}
septic_patients %>%
freq(hospital_id)
```
... to this, where items are now sorted on factor levels:
```{r, echo = TRUE}
septic_patients %>%
freq(hospital_id, sort.count = FALSE)
```
All classes will be printed into the header. Variables with the new `rsi` class of this AMR package are actually ordered factors and have three classes (look at `Class` in the header):
```{r, echo = TRUE}
septic_patients %>%
freq(AMX, header = TRUE)
```
## Frequencies of dates
Frequencies of dates will show the oldest and newest date in the data, and the amount of days between them:
```{r, echo = TRUE}
septic_patients %>%
freq(date, nmax = 5, header = TRUE)
```
## Assigning a frequency table to an object
A frequency table is actually a regular `data.frame`, with the exception that it contains an additional class.
```{r, echo = TRUE}
my_df <- septic_patients %>% freq(age)
class(my_df)
```
Because of this additional class, a frequency table prints like the examples above. But the object itself contains the complete table without a row limitation:
```{r, echo = TRUE}
dim(my_df)
```
## Additional parameters
### Parameter `na.rm`
With the `na.rm` parameter you can remove `NA` values from the frequency table (defaults to `TRUE`, but the number of `NA` values will always be shown into the header):
```{r, echo = TRUE}
septic_patients %>%
freq(AMX, na.rm = FALSE)
```
### Parameter `row.names`
A frequency table shows row indices. To remove them, use `row.names = FALSE`:
```{r, echo = TRUE}
septic_patients %>%
freq(hospital_id, row.names = FALSE)
```
### Parameter `markdown`
The `markdown` parameter is `TRUE` at default in non-interactive sessions, like in reports created with R Markdown. This will always print all rows, unless `nmax` is set. Without markdown (like in regular R), a frequency table would print like:
```{r, echo = TRUE, results = 'markup'}
septic_patients %>%
freq(hospital_id, markdown = FALSE)
```