1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 20:06:12 +01:00

(v1.4.0.9026) docu update

This commit is contained in:
dr. M.S. (Matthijs) Berends 2020-11-24 11:47:54 +01:00
parent b045b571a6
commit 7b42b15c90
21 changed files with 47 additions and 50 deletions

View File

@ -1,6 +1,6 @@
Package: AMR Package: AMR
Version: 1.4.0.9025 Version: 1.4.0.9026
Date: 2020-11-23 Date: 2020-11-24
Title: Antimicrobial Resistance Analysis Title: Antimicrobial Resistance Analysis
Authors@R: c( Authors@R: c(
person(role = c("aut", "cre"), person(role = c("aut", "cre"),

View File

@ -1,5 +1,5 @@
# AMR 1.4.0.9025 # AMR 1.4.0.9026
## <small>Last updated: 23 November 2020</small> ## <small>Last updated: 24 November 2020</small>
### New ### New
* Function `is_new_episode()` to determine patient episodes which are not necessarily based on microorganisms. It also supports grouped variables with e.g. `mutate()`, `filter()` and `summarise()` of the `dplyr` package: * Function `is_new_episode()` to determine patient episodes which are not necessarily based on microorganisms. It also supports grouped variables with e.g. `mutate()`, `filter()` and `summarise()` of the `dplyr` package:

View File

@ -27,7 +27,7 @@
#' #'
#' Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type. To determine patient episodes not necessarily based on microorganisms, use [is_new_episode()] that also supports grouping with the `dplyr` package. #' Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type. To determine patient episodes not necessarily based on microorganisms, use [is_new_episode()] that also supports grouping with the `dplyr` package.
#' @inheritSection lifecycle Stable lifecycle #' @inheritSection lifecycle Stable lifecycle
#' @param x,.data a [data.frame] containing isolates. #' @param x a [data.frame] containing isolates.
#' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class #' @param col_date column name of the result date (or date that is was received on the lab), defaults to the first column with a date class
#' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive) #' @param col_patient_id column name of the unique IDs of the patients, defaults to the first column that starts with 'patient' or 'patid' (case insensitive)
#' @param col_mo column name of the IDs of the microorganisms (see [as.mo()]), defaults to the first column of class [`mo`]. Values will be coerced using [as.mo()]. #' @param col_mo column name of the IDs of the microorganisms (see [as.mo()]), defaults to the first column of class [`mo`]. Values will be coerced using [as.mo()].
@ -44,7 +44,7 @@
#' @param points_threshold points until the comparison of key antibiotics will lead to inclusion of an isolate when `type = "points"`, see Details #' @param points_threshold points until the comparison of key antibiotics will lead to inclusion of an isolate when `type = "points"`, see Details
#' @param info print progress #' @param info print progress
#' @param include_unknown logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code `"UNKNOWN"`, which defaults to `FALSE`. For WHONET users, this means that all records with organism code `"con"` (*contamination*) will be excluded at default. Isolates with a microbial ID of `NA` will always be excluded as first isolate. #' @param include_unknown logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code `"UNKNOWN"`, which defaults to `FALSE`. For WHONET users, this means that all records with organism code `"con"` (*contamination*) will be excluded at default. Isolates with a microbial ID of `NA` will always be excluded as first isolate.
#' @param ... parameters passed on to the [first_isolate()] function #' @param ... parameters passed on to [first_isolate()] when using [filter_first_isolate()], or parameters passed on to [key_antibiotics()] when using [filter_first_weighted_isolate()]
#' @details The [first_isolate()] function is a wrapper around the [is_new_episode()] function, but more efficient for data sets containing microorganism codes or names. #' @details The [first_isolate()] function is a wrapper around the [is_new_episode()] function, but more efficient for data sets containing microorganism codes or names.
#' #'
#' All isolates with a microbial ID of `NA` will be excluded as first isolate. #' All isolates with a microbial ID of `NA` will be excluded as first isolate.

View File

@ -36,7 +36,7 @@
#' @param facet variable to split plots by, either `"interpretation"` (default) or `"antibiotic"` or a grouping variable #' @param facet variable to split plots by, either `"interpretation"` (default) or `"antibiotic"` or a grouping variable
#' @inheritParams proportion #' @inheritParams proportion
#' @param nrow (when using `facet`) number of rows #' @param nrow (when using `facet`) number of rows
#' @param colours a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be `FALSE` to use default [ggplot2][[ggplot2::ggplot()] colours. #' @param colours a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be `FALSE` to use default [ggplot2][ggplot2::ggplot()] colours.
#' @param datalabels show datalabels using [labels_rsi_count()] #' @param datalabels show datalabels using [labels_rsi_count()]
#' @param datalabels.size size of the datalabels #' @param datalabels.size size of the datalabels
#' @param datalabels.colour colour of the datalabels #' @param datalabels.colour colour of the datalabels
@ -107,13 +107,12 @@
#' } #' }
#' #'
#' \donttest{ #' \donttest{
#'
#' # resistance of ciprofloxacine per age group #' # resistance of ciprofloxacine per age group
#' example_isolates %>% #' example_isolates %>%
#' mutate(first_isolate = first_isolate(.)) %>% #' mutate(first_isolate = first_isolate(.)) %>%
#' filter(first_isolate == TRUE, #' filter(first_isolate == TRUE,
#' mo == as.mo("E. coli")) %>% #' mo == as.mo("E. coli")) %>%
#' # `age_groups` is also a function of this AMR package: #' # age_groups() is also a function in this AMR package:
#' group_by(age_group = age_groups(age)) %>% #' group_by(age_group = age_groups(age)) %>%
#' select(age_group, #' select(age_group,
#' CIP) %>% #' CIP) %>%

View File

@ -73,5 +73,6 @@ globalVariables(c(".rowid",
"value", "value",
"varname", "varname",
"xvar", "xvar",
"y",
"year", "year",
"yvar")) "yvar"))

View File

@ -33,7 +33,7 @@
#' @details #' @details
#' Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least `episode_days` days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least `episode_days` days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored. #' Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least `episode_days` days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least `episode_days` days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored.
#' #'
#' The `dplyr` package is not required for this function to work, but this function works conveniently inside `dplyr` verbs such as [filter()], [mutate()] and [summarise()]. #' The `dplyr` package is not required for this function to work, but this function works conveniently inside `dplyr` verbs such as [`filter()`][dplyr::filter()], [`mutate()`][dplyr::mutate()] and [`summarise()`][dplyr::summarise()].
#' @return a [logical] vector #' @return a [logical] vector
#' @export #' @export
#' @inheritSection AMR Read more on our website! #' @inheritSection AMR Read more on our website!
@ -86,23 +86,17 @@ is_new_episode <- function(x, episode_days = 365, ...) {
x <- as.double(as.Date(x, ...)) # as.Date() for POSIX classes x <- as.double(as.Date(x, ...)) # as.Date() for POSIX classes
if (length(x) == 1) { if (length(x) == 1) {
return(TRUE) return(TRUE)
} } else if (length(x) == 2) {
if (length(x) == 2 && max(x) - min(x) >= episode_days) { if (max(x) - min(x) >= episode_days) {
return(rep(TRUE, 2)) return(c(TRUE, TRUE))
} else {
return(c(TRUE, FALSE))
}
} }
# I asked on StackOverflow: # I asked on StackOverflow:
# https://stackoverflow.com/questions/42122245/filter-one-row-every-year # https://stackoverflow.com/questions/42122245/filter-one-row-every-year
exec <- function(x, episode_days) { exec <- function(x, episode_days) {
if (length(x) == 1) {
return(TRUE)
} else if (length(x) == 2) {
if (max(x) - min(x) >= episode_days) {
return(c(TRUE, TRUE))
} else {
return(c(TRUE, FALSE))
}
}
indices <- integer() indices <- integer()
start <- x[1] start <- x[1]
ind <- 1 ind <- 1

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a> <a class="navbar-link" href="https://msberends.github.io/AMR//index.html">AMR (for R)</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>

View File

@ -43,7 +43,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>
@ -236,13 +236,13 @@
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small> <small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
</div> </div>
<div id="amr-1409025" class="section level1"> <div id="amr-1409026" class="section level1">
<h1 class="page-header" data-toc-text="1.4.0.9025"> <h1 class="page-header" data-toc-text="1.4.0.9026">
<a href="#amr-1409025" class="anchor"></a>AMR 1.4.0.9025<small> Unreleased </small> <a href="#amr-1409026" class="anchor"></a>AMR 1.4.0.9026<small> Unreleased </small>
</h1> </h1>
<div id="last-updated-23-november-2020" class="section level2"> <div id="last-updated-24-november-2020" class="section level2">
<h2 class="hasAnchor"> <h2 class="hasAnchor">
<a href="#last-updated-23-november-2020" class="anchor"></a><small>Last updated: 23 November 2020</small> <a href="#last-updated-24-november-2020" class="anchor"></a><small>Last updated: 24 November 2020</small>
</h2> </h2>
<div id="new" class="section level3"> <div id="new" class="section level3">
<h3 class="hasAnchor"> <h3 class="hasAnchor">

View File

@ -12,7 +12,7 @@ articles:
datasets: datasets.html datasets: datasets.html
resistance_predict: resistance_predict.html resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html welcome_to_AMR: welcome_to_AMR.html
last_built: 2020-11-23T20:45Z last_built: 2020-11-24T10:47Z
urls: urls:
reference: https://msberends.github.io/AMR//reference reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles article: https://msberends.github.io/AMR//articles

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>
@ -284,7 +284,7 @@
<table class="ref-arguments"> <table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup> <colgroup><col class="name" /><col class="desc" /></colgroup>
<tr> <tr>
<th>x, .data</th> <th>x</th>
<td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> containing isolates.</p></td> <td><p>a <a href='https://rdrr.io/r/base/data.frame.html'>data.frame</a> containing isolates.</p></td>
</tr> </tr>
<tr> <tr>
@ -353,7 +353,7 @@
</tr> </tr>
<tr> <tr>
<th>...</th> <th>...</th>
<td><p>parameters passed on to the <code>first_isolate()</code> function</p></td> <td><p>parameters passed on to <code>first_isolate()</code> when using <code>filter_first_isolate()</code>, or parameters passed on to <code><a href='key_antibiotics.html'>key_antibiotics()</a></code> when using <code>filter_first_weighted_isolate()</code></p></td>
</tr> </tr>
</table> </table>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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">1.4.0.9008</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>
@ -361,7 +361,7 @@
</tr> </tr>
<tr> <tr>
<th>colours</th> <th>colours</th>
<td><p>a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be <code>FALSE</code> to use default [ggplot2][<code><a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot2::ggplot()</a></code> colours.</p></td> <td><p>a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be <code>FALSE</code> to use default <a href='https://ggplot2.tidyverse.org/reference/ggplot.html'>ggplot2</a> colours.</p></td>
</tr> </tr>
<tr> <tr>
<th>datalabels</th> <th>datalabels</th>
@ -468,13 +468,12 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
<span class='op'>}</span> <span class='op'>}</span>
<span class='co'># \donttest{</span> <span class='co'># \donttest{</span>
<span class='co'># resistance of ciprofloxacine per age group</span> <span class='co'># resistance of ciprofloxacine per age group</span>
<span class='va'>example_isolates</span> <span class='op'>%&gt;%</span> <span class='va'>example_isolates</span> <span class='op'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span><span class='op'>(</span>first_isolate <span class='op'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span><span class='op'>(</span><span class='va'>.</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span><span class='op'>(</span>first_isolate <span class='op'>=</span> <span class='fu'><a href='first_isolate.html'>first_isolate</a></span><span class='op'>(</span><span class='va'>.</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span><span class='op'>(</span><span class='va'>first_isolate</span> <span class='op'>==</span> <span class='cn'>TRUE</span>, <span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span><span class='op'>(</span><span class='va'>first_isolate</span> <span class='op'>==</span> <span class='cn'>TRUE</span>,
<span class='va'>mo</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='st'>"E. coli"</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>%&gt;%</span> <span class='va'>mo</span> <span class='op'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span><span class='op'>(</span><span class='st'>"E. coli"</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>%&gt;%</span>
<span class='co'># `age_groups` is also a function of this AMR package:</span> <span class='co'># age_groups() is also a function in this AMR package:</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span><span class='op'>(</span>age_group <span class='op'>=</span> <span class='fu'><a href='age_groups.html'>age_groups</a></span><span class='op'>(</span><span class='va'>age</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>%&gt;%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span><span class='op'>(</span>age_group <span class='op'>=</span> <span class='fu'><a href='age_groups.html'>age_groups</a></span><span class='op'>(</span><span class='va'>age</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>%&gt;%</span>
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span><span class='op'>(</span><span class='va'>age_group</span>, <span class='fu'><a href='https://dplyr.tidyverse.org/reference/select.html'>select</a></span><span class='op'>(</span><span class='va'>age_group</span>,
<span class='va'>CIP</span><span class='op'>)</span> <span class='op'>%&gt;%</span> <span class='va'>CIP</span><span class='op'>)</span> <span class='op'>%&gt;%</span>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>

View File

@ -82,7 +82,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="../index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>
@ -274,6 +274,11 @@
<p><img src='figures/lifecycle_experimental.svg' style=margin-bottom:5px /> <br /> <p><img src='figures/lifecycle_experimental.svg' style=margin-bottom:5px /> <br />
The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>experimental</strong>. An experimental function is in early stages of development. The unlying code might be changing frequently. Experimental functions might be removed without deprecation, so you are generally best off waiting until a function is more mature before you use it in production code. Experimental functions are only available in development versions of this <code>AMR</code> package and will thus not be included in releases that are submitted to CRAN, since such functions have not yet matured enough.</p> The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>experimental</strong>. An experimental function is in early stages of development. The unlying code might be changing frequently. Experimental functions might be removed without deprecation, so you are generally best off waiting until a function is more mature before you use it in production code. Experimental functions are only available in development versions of this <code>AMR</code> package and will thus not be included in releases that are submitted to CRAN, since such functions have not yet matured enough.</p>
<h2 class="hasAnchor" id="read-more-on-our-website-"><a class="anchor" href="#read-more-on-our-website-"></a>Read more on our website!</h2>
<p>On our website <a href='https://msberends.github.io/AMR/'>https://msberends.github.io/AMR/</a> you can find <a href='https://msberends.github.io/AMR/articles/AMR.html'>a comprehensive tutorial</a> about how to conduct AMR analysis, the <a href='https://msberends.github.io/AMR/reference/'>complete documentation of all functions</a> and <a href='https://msberends.github.io/AMR/articles/WHONET.html'>an example analysis using WHONET data</a>. As we would like to better understand the backgrounds and needs of our users, please <a href='https://msberends.github.io/AMR/survey.html'>participate in our survey</a>!</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span> <pre class="examples"><span class='co'># `example_isolates` is a dataset available in the AMR package.</span>

View File

@ -81,7 +81,7 @@
</button> </button>
<span class="navbar-brand"> <span class="navbar-brand">
<a class="navbar-link" href="index.html">AMR (for R)</a> <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">1.4.0.9025</span> <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.4.0.9026</span>
</span> </span>
</div> </div>

View File

@ -50,7 +50,7 @@ filter_first_weighted_isolate(
) )
} }
\arguments{ \arguments{
\item{x, .data}{a \link{data.frame} containing isolates.} \item{x}{a \link{data.frame} containing isolates.}
\item{col_date}{column name of the result date (or date that is was received on the lab), defaults to the first column with a date class} \item{col_date}{column name of the result date (or date that is was received on the lab), defaults to the first column with a date class}
@ -84,7 +84,7 @@ filter_first_weighted_isolate(
\item{include_unknown}{logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code \code{"UNKNOWN"}, which defaults to \code{FALSE}. For WHONET users, this means that all records with organism code \code{"con"} (\emph{contamination}) will be excluded at default. Isolates with a microbial ID of \code{NA} will always be excluded as first isolate.} \item{include_unknown}{logical to determine whether 'unknown' microorganisms should be included too, i.e. microbial code \code{"UNKNOWN"}, which defaults to \code{FALSE}. For WHONET users, this means that all records with organism code \code{"con"} (\emph{contamination}) will be excluded at default. Isolates with a microbial ID of \code{NA} will always be excluded as first isolate.}
\item{...}{parameters passed on to the \code{\link[=first_isolate]{first_isolate()}} function} \item{...}{parameters passed on to \code{\link[=first_isolate]{first_isolate()}} when using \code{\link[=filter_first_isolate]{filter_first_isolate()}}, or parameters passed on to \code{\link[=key_antibiotics]{key_antibiotics()}} when using \code{\link[=filter_first_weighted_isolate]{filter_first_weighted_isolate()}}}
} }
\value{ \value{
A \code{\link{logical}} vector A \code{\link{logical}} vector

View File

@ -99,7 +99,7 @@ labels_rsi_count(
\item{nrow}{(when using \code{facet}) number of rows} \item{nrow}{(when using \code{facet}) number of rows}
\item{colours}{a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be \code{FALSE} to use default [ggplot2][\code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} colours.} \item{colours}{a named vector with colours for the bars. The names must be one or more of: S, SI, I, IR, R or be \code{FALSE} to use default \link[ggplot2:ggplot]{ggplot2} colours.}
\item{datalabels}{show datalabels using \code{\link[=labels_rsi_count]{labels_rsi_count()}}} \item{datalabels}{show datalabels using \code{\link[=labels_rsi_count]{labels_rsi_count()}}}
@ -194,13 +194,12 @@ if (require("ggplot2") & require("dplyr")) {
} }
\donttest{ \donttest{
# resistance of ciprofloxacine per age group # resistance of ciprofloxacine per age group
example_isolates \%>\% example_isolates \%>\%
mutate(first_isolate = first_isolate(.)) \%>\% mutate(first_isolate = first_isolate(.)) \%>\%
filter(first_isolate == TRUE, filter(first_isolate == TRUE,
mo == as.mo("E. coli")) \%>\% mo == as.mo("E. coli")) \%>\%
# `age_groups` is also a function of this AMR package: # age_groups() is also a function in this AMR package:
group_by(age_group = age_groups(age)) \%>\% group_by(age_group = age_groups(age)) \%>\%
select(age_group, select(age_group,
CIP) \%>\% CIP) \%>\%

View File

@ -22,7 +22,7 @@ This function determines which items in a vector can be considered (the start of
\details{ \details{
Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least \code{episode_days} days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least \code{episode_days} days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored. Dates are first sorted from old to new. The oldest date will mark the start of the first episode. After this date, the next date will be marked that is at least \code{episode_days} days later than the start of the first episode. From that second marked date on, the next date will be marked that is at least \code{episode_days} days later than the start of the second episode which will be the start of the third episode, and so on. Before the vector is being returned, the original order will be restored.
The \code{dplyr} package is not required for this function to work, but this function works conveniently inside \code{dplyr} verbs such as \code{\link[=filter]{filter()}}, \code{\link[=mutate]{mutate()}} and \code{\link[=summarise]{summarise()}}. The \code{dplyr} package is not required for this function to work, but this function works conveniently inside \code{dplyr} verbs such as \code{\link[dplyr:filter]{filter()}}, \code{\link[dplyr:mutate]{mutate()}} and \code{\link[dplyr:summarise]{summarise()}}.
} }
\section{Experimental lifecycle}{ \section{Experimental lifecycle}{