mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 05:26:13 +01:00
(v1.3.0) skip more CRAN tests
This commit is contained in:
parent
c8edcb7439
commit
c5f7294381
@ -1,6 +1,4 @@
|
|||||||
^.*\.Rproj$
|
^.*\.Rproj$
|
||||||
^\.gitlab-ci\.R$
|
|
||||||
^\.gitlab-ci\.yml$
|
|
||||||
^\.Renviron$
|
^\.Renviron$
|
||||||
^\.Rprofile$
|
^\.Rprofile$
|
||||||
^\.Rproj\.user$
|
^\.Rproj\.user$
|
||||||
@ -23,6 +21,4 @@
|
|||||||
^public$
|
^public$
|
||||||
^data-raw$
|
^data-raw$
|
||||||
^\.lintr$
|
^\.lintr$
|
||||||
^vignettes/benchmark.*
|
^vignettes$
|
||||||
^vignettes/SPSS.*
|
|
||||||
^tests/appveyor$
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.3.0
|
Version: 1.3.0
|
||||||
Date: 2020-07-30
|
Date: 2020-07-31
|
||||||
Title: Antimicrobial Resistance Analysis
|
Title: Antimicrobial Resistance Analysis
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person(role = c("aut", "cre"),
|
person(role = c("aut", "cre"),
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
#' @name antibiotic_class_selectors
|
#' @name antibiotic_class_selectors
|
||||||
#' @export
|
#' @export
|
||||||
#' @examples
|
#' @examples
|
||||||
#' if (require("dplyr")) {
|
#' \dontrun{
|
||||||
|
#' library(dplyr)
|
||||||
#'
|
#'
|
||||||
#' # this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
#' # this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
||||||
#' example_isolates %>%
|
#' example_isolates %>%
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
#' abx <- ab_from_text("500 mg amoxi po and 400mg cipro iv")
|
#' abx <- ab_from_text("500 mg amoxi po and 400mg cipro iv")
|
||||||
#' ab_group(abx[[1]])
|
#' ab_group(abx[[1]])
|
||||||
#'
|
#'
|
||||||
#' if (require(dplyr)) {
|
#' if (require("dplyr")) {
|
||||||
#' tibble(clinical_text = c("given 400mg cipro and 500 mg amox",
|
#' tibble(clinical_text = c("given 400mg cipro and 500 mg amox",
|
||||||
#' "started on doxy iv today")) %>%
|
#' "started on doxy iv today")) %>%
|
||||||
#' mutate(abx_codes = ab_from_text(clinical_text),
|
#' mutate(abx_codes = ab_from_text(clinical_text),
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
#' @seealso [antibiotic_class_selectors()] for the `select()` equivalent.
|
#' @seealso [antibiotic_class_selectors()] for the `select()` equivalent.
|
||||||
#' @export
|
#' @export
|
||||||
#' @examples
|
#' @examples
|
||||||
#' if (require(dplyr)) {
|
#' \dontrun{
|
||||||
|
#' library(dplyr)
|
||||||
#'
|
#'
|
||||||
#' # filter on isolates that have any result for any aminoglycoside
|
#' # filter on isolates that have any result for any aminoglycoside
|
||||||
#' example_isolates %>% filter_ab_class("aminoglycoside")
|
#' example_isolates %>% filter_ab_class("aminoglycoside")
|
||||||
@ -62,9 +63,7 @@
|
|||||||
#' example_isolates %>%
|
#' example_isolates %>%
|
||||||
#' filter_aminoglycosides("R", "all") %>%
|
#' filter_aminoglycosides("R", "all") %>%
|
||||||
#' filter_fluoroquinolones("R", "all")
|
#' filter_fluoroquinolones("R", "all")
|
||||||
#' }
|
|
||||||
#'
|
#'
|
||||||
#' \dontrun{
|
|
||||||
#' # with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:
|
#' # with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:
|
||||||
#' example_isolates %>% filter_carbapenems("R", "all")
|
#' example_isolates %>% filter_carbapenems("R", "all")
|
||||||
#' example_isolates %>% filter(across(carbapenems(), ~. == "R"))
|
#' example_isolates %>% filter(across(carbapenems(), ~. == "R"))
|
||||||
|
@ -60,7 +60,8 @@
|
|||||||
#' # See ?example_isolates.
|
#' # See ?example_isolates.
|
||||||
#'
|
#'
|
||||||
#' # See ?pca for more info about Principal Component Analysis (PCA).
|
#' # See ?pca for more info about Principal Component Analysis (PCA).
|
||||||
#' if (require("dplyr")) {
|
#' \dontrun{
|
||||||
|
#' library(dplyr)
|
||||||
#' pca_model <- example_isolates %>%
|
#' pca_model <- example_isolates %>%
|
||||||
#' filter(mo_genus(mo) == "Staphylococcus") %>%
|
#' filter(mo_genus(mo) == "Staphylococcus") %>%
|
||||||
#' group_by(species = mo_shortname(mo)) %>%
|
#' group_by(species = mo_shortname(mo)) %>%
|
||||||
|
@ -84,7 +84,9 @@
|
|||||||
#' }
|
#' }
|
||||||
#'
|
#'
|
||||||
#' # create nice plots with ggplot2 yourself
|
#' # create nice plots with ggplot2 yourself
|
||||||
#' if (require(ggplot2) & require("dplyr")) {
|
#' \dontrun{
|
||||||
|
#' library(dplyr)
|
||||||
|
#' library(ggplot2)
|
||||||
#'
|
#'
|
||||||
#' data <- example_isolates %>%
|
#' data <- example_isolates %>%
|
||||||
#' filter(mo == as.mo("E. coli")) %>%
|
#' filter(mo == as.mo("E. coli")) %>%
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
* For this specific version, nothing to mention.
|
* Edited the unit tests, so they will run under 10 minutes on CRAN (using testthat::skip_on_cran() on some tests).
|
||||||
|
|
||||||
* Since version 0.3.0 (2018-08-14), CHECK returns a NOTE for having a data directory over 3 MB. This is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this package.
|
* Since version 0.3.0 (2018-08-14), CHECK returns a NOTE for having a data directory over 3 MB. This is needed to offer users reference data for the complete taxonomy of microorganisms - one of the most important features of this package.
|
||||||
|
@ -10,7 +10,7 @@ articles:
|
|||||||
WHONET: WHONET.html
|
WHONET: WHONET.html
|
||||||
benchmarks: benchmarks.html
|
benchmarks: benchmarks.html
|
||||||
resistance_predict: resistance_predict.html
|
resistance_predict: resistance_predict.html
|
||||||
last_built: 2020-07-30T13:15Z
|
last_built: 2020-07-31T08:49Z
|
||||||
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
|
||||||
|
@ -321,7 +321,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
|||||||
<span class='no'>abx</span> <span class='kw'><-</span> <span class='fu'>ab_from_text</span>(<span class='st'>"500 mg amoxi po and 400mg cipro iv"</span>)
|
<span class='no'>abx</span> <span class='kw'><-</span> <span class='fu'>ab_from_text</span>(<span class='st'>"500 mg amoxi po and 400mg cipro iv"</span>)
|
||||||
<span class='fu'><a href='ab_property.html'>ab_group</a></span>(<span class='no'>abx</span><span class='kw'>[[</span><span class='fl'>1</span>]])
|
<span class='fu'><a href='ab_property.html'>ab_group</a></span>(<span class='no'>abx</span><span class='kw'>[[</span><span class='fl'>1</span>]])
|
||||||
|
|
||||||
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='no'>dplyr</span>)) {
|
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/reexports.html'>tibble</a></span>(<span class='kw'>clinical_text</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"given 400mg cipro and 500 mg amox"</span>,
|
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/reexports.html'>tibble</a></span>(<span class='kw'>clinical_text</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"given 400mg cipro and 500 mg amox"</span>,
|
||||||
<span class='st'>"started on doxy iv today"</span>)) <span class='kw'>%>%</span>
|
<span class='st'>"started on doxy iv today"</span>)) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>abx_codes</span> <span class='kw'>=</span> <span class='fu'>ab_from_text</span>(<span class='no'>clinical_text</span>),
|
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='kw'>abx_codes</span> <span class='kw'>=</span> <span class='fu'>ab_from_text</span>(<span class='no'>clinical_text</span>),
|
||||||
|
@ -281,7 +281,8 @@
|
|||||||
<div class='dont-index'><p><code><a href='filter_ab_class.html'>filter_ab_class()</a></code> for the <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> equivalent.</p></div>
|
<div class='dont-index'><p><code><a href='filter_ab_class.html'>filter_ab_class()</a></code> for the <code><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter()</a></code> equivalent.</p></div>
|
||||||
|
|
||||||
<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='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
|
<pre class="examples"><span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
|
||||||
|
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
|
|
||||||
<span class='co'># this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):</span>
|
<span class='co'># this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):</span>
|
||||||
<span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
<span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
||||||
|
@ -303,7 +303,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
|||||||
<div class='dont-index'><p><code><a href='antibiotic_class_selectors.html'>antibiotic_class_selectors()</a></code> for the <code><a href='https://dplyr.tidyverse.org/reference/select.html'>select()</a></code> equivalent.</p></div>
|
<div class='dont-index'><p><code><a href='antibiotic_class_selectors.html'>antibiotic_class_selectors()</a></code> for the <code><a href='https://dplyr.tidyverse.org/reference/select.html'>select()</a></code> equivalent.</p></div>
|
||||||
|
|
||||||
<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='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='no'>dplyr</span>)) {
|
<pre class="examples"><span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
|
||||||
|
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
|
|
||||||
<span class='co'># filter on isolates that have any result for any aminoglycoside</span>
|
<span class='co'># filter on isolates that have any result for any aminoglycoside</span>
|
||||||
<span class='no'>example_isolates</span> <span class='kw'>%>%</span> <span class='fu'>filter_ab_class</span>(<span class='st'>"aminoglycoside"</span>)
|
<span class='no'>example_isolates</span> <span class='kw'>%>%</span> <span class='fu'>filter_ab_class</span>(<span class='st'>"aminoglycoside"</span>)
|
||||||
@ -332,9 +333,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
|||||||
<span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
<span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>) <span class='kw'>%>%</span>
|
<span class='fu'>filter_aminoglycosides</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'>filter_fluoroquinolones</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
<span class='fu'>filter_fluoroquinolones</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||||
}
|
|
||||||
|
|
||||||
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
|
|
||||||
<span class='co'># with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:</span>
|
<span class='co'># with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:</span>
|
||||||
<span class='no'>example_isolates</span> <span class='kw'>%>%</span> <span class='fu'>filter_carbapenems</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
<span class='no'>example_isolates</span> <span class='kw'>%>%</span> <span class='fu'>filter_carbapenems</span>(<span class='st'>"R"</span>, <span class='st'>"all"</span>)
|
||||||
<span class='no'>example_isolates</span> <span class='kw'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='fu'><a href='antibiotic_class_selectors.html'>carbapenems</a></span>(), ~<span class='no'>.</span> <span class='kw'>==</span> <span class='st'>"R"</span>))
|
<span class='no'>example_isolates</span> <span class='kw'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='fu'><a href='antibiotic_class_selectors.html'>carbapenems</a></span>(), ~<span class='no'>.</span> <span class='kw'>==</span> <span class='st'>"R"</span>))
|
||||||
|
@ -388,7 +388,8 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>maturing<
|
|||||||
<span class='co'># See ?example_isolates.</span>
|
<span class='co'># See ?example_isolates.</span>
|
||||||
|
|
||||||
<span class='co'># See ?pca for more info about Principal Component Analysis (PCA).</span>
|
<span class='co'># See ?pca for more info about Principal Component Analysis (PCA).</span>
|
||||||
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
|
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
|
||||||
|
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
<span class='no'>pca_model</span> <span class='kw'><-</span> <span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
<span class='no'>pca_model</span> <span class='kw'><-</span> <span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='no'>mo</span>) <span class='kw'>==</span> <span class='st'>"Staphylococcus"</span>) <span class='kw'>%>%</span>
|
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='fu'><a href='mo_property.html'>mo_genus</a></span>(<span class='no'>mo</span>) <span class='kw'>==</span> <span class='st'>"Staphylococcus"</span>) <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>species</span> <span class='kw'>=</span> <span class='fu'><a href='mo_property.html'>mo_shortname</a></span>(<span class='no'>mo</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/group_by.html'>group_by</a></span>(<span class='kw'>species</span> <span class='kw'>=</span> <span class='fu'><a href='mo_property.html'>mo_shortname</a></span>(<span class='no'>mo</span>)) <span class='kw'>%>%</span>
|
||||||
|
@ -411,7 +411,9 @@ A microorganism is categorised as <em>Susceptible, Increased exposure</em> when
|
|||||||
}
|
}
|
||||||
|
|
||||||
<span class='co'># create nice plots with ggplot2 yourself</span>
|
<span class='co'># create nice plots with ggplot2 yourself</span>
|
||||||
<span class='kw'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='no'>ggplot2</span>) <span class='kw'>&</span> <span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'>"dplyr"</span>)) {
|
<span class='kw'>if</span> (<span class='fl'>FALSE</span>) {
|
||||||
|
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>dplyr</span>)
|
||||||
|
<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>ggplot2</span>)
|
||||||
|
|
||||||
<span class='no'>data</span> <span class='kw'><-</span> <span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
<span class='no'>data</span> <span class='kw'><-</span> <span class='no'>example_isolates</span> <span class='kw'>%>%</span>
|
||||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/filter.html'>filter</a></span>(<span class='no'>mo</span> <span class='kw'>==</span> <span class='fu'><a href='as.mo.html'>as.mo</a></span>(<span class='st'>"E. coli"</span>)) <span class='kw'>%>%</span>
|
||||||
|
@ -80,7 +80,7 @@ ab_from_text("500 mg amoxi po and 400mg cipro iv", collapse = ", ")
|
|||||||
abx <- ab_from_text("500 mg amoxi po and 400mg cipro iv")
|
abx <- ab_from_text("500 mg amoxi po and 400mg cipro iv")
|
||||||
ab_group(abx[[1]])
|
ab_group(abx[[1]])
|
||||||
|
|
||||||
if (require(dplyr)) {
|
if (require("dplyr")) {
|
||||||
tibble(clinical_text = c("given 400mg cipro and 500 mg amox",
|
tibble(clinical_text = c("given 400mg cipro and 500 mg amox",
|
||||||
"started on doxy iv today")) \%>\%
|
"started on doxy iv today")) \%>\%
|
||||||
mutate(abx_codes = ab_from_text(clinical_text),
|
mutate(abx_codes = ab_from_text(clinical_text),
|
||||||
|
@ -58,7 +58,8 @@ All columns will be searched for known antibiotic names, abbreviations, brand na
|
|||||||
These functions only work if the \code{tidyselect} package is installed, that comes with the \code{dplyr} package. An error will be thrown if \code{tidyselect} package is not installed, or if the functions are used outside a function that allows Tidyverse selections like \code{select()} or \code{pivot_longer()}.
|
These functions only work if the \code{tidyselect} package is installed, that comes with the \code{dplyr} package. An error will be thrown if \code{tidyselect} package is not installed, or if the functions are used outside a function that allows Tidyverse selections like \code{select()} or \code{pivot_longer()}.
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
if (require("dplyr")) {
|
\dontrun{
|
||||||
|
library(dplyr)
|
||||||
|
|
||||||
# this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
# this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
||||||
example_isolates \%>\%
|
example_isolates \%>\%
|
||||||
|
@ -71,7 +71,8 @@ If the unlying code needs breaking changes, they will occur gradually. For examp
|
|||||||
}
|
}
|
||||||
|
|
||||||
\examples{
|
\examples{
|
||||||
if (require(dplyr)) {
|
\dontrun{
|
||||||
|
library(dplyr)
|
||||||
|
|
||||||
# filter on isolates that have any result for any aminoglycoside
|
# filter on isolates that have any result for any aminoglycoside
|
||||||
example_isolates \%>\% filter_ab_class("aminoglycoside")
|
example_isolates \%>\% filter_ab_class("aminoglycoside")
|
||||||
@ -100,9 +101,7 @@ example_isolates \%>\%
|
|||||||
example_isolates \%>\%
|
example_isolates \%>\%
|
||||||
filter_aminoglycosides("R", "all") \%>\%
|
filter_aminoglycosides("R", "all") \%>\%
|
||||||
filter_fluoroquinolones("R", "all")
|
filter_fluoroquinolones("R", "all")
|
||||||
}
|
|
||||||
|
|
||||||
\dontrun{
|
|
||||||
# with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:
|
# with dplyr 1.0.0 and higher (that adds 'across()'), this is equal:
|
||||||
example_isolates \%>\% filter_carbapenems("R", "all")
|
example_isolates \%>\% filter_carbapenems("R", "all")
|
||||||
example_isolates \%>\% filter(across(carbapenems(), ~. == "R"))
|
example_isolates \%>\% filter(across(carbapenems(), ~. == "R"))
|
||||||
|
@ -118,7 +118,8 @@ The \link[=lifecycle]{lifecycle} of this function is \strong{maturing}. The unly
|
|||||||
# See ?example_isolates.
|
# See ?example_isolates.
|
||||||
|
|
||||||
# See ?pca for more info about Principal Component Analysis (PCA).
|
# See ?pca for more info about Principal Component Analysis (PCA).
|
||||||
if (require("dplyr")) {
|
\dontrun{
|
||||||
|
library(dplyr)
|
||||||
pca_model <- example_isolates \%>\%
|
pca_model <- example_isolates \%>\%
|
||||||
filter(mo_genus(mo) == "Staphylococcus") \%>\%
|
filter(mo_genus(mo) == "Staphylococcus") \%>\%
|
||||||
group_by(species = mo_shortname(mo)) \%>\%
|
group_by(species = mo_shortname(mo)) \%>\%
|
||||||
|
@ -150,7 +150,9 @@ if (require("dplyr")) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# create nice plots with ggplot2 yourself
|
# create nice plots with ggplot2 yourself
|
||||||
if (require(ggplot2) & require("dplyr")) {
|
\dontrun{
|
||||||
|
library(dplyr)
|
||||||
|
library(ggplot2)
|
||||||
|
|
||||||
data <- example_isolates \%>\%
|
data <- example_isolates \%>\%
|
||||||
filter(mo == as.mo("E. coli")) \%>\%
|
filter(mo == as.mo("E. coli")) \%>\%
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
context("ab.R")
|
context("ab.R")
|
||||||
|
|
||||||
test_that("as.ab works", {
|
test_that("as.ab works", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
expect_equal(as.character(as.ab(c("J01FA01",
|
expect_equal(as.character(as.ab(c("J01FA01",
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
context("ab_from_text.R")
|
context("ab_from_text.R")
|
||||||
|
|
||||||
test_that("ab_from_text works", {
|
test_that("ab_from_text works", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
expect_identical(ab_from_text("28/03/2020 regular amoxicilliin 500mg po tds")[[1]],
|
expect_identical(ab_from_text("28/03/2020 regular amoxicilliin 500mg po tds")[[1]],
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
context("ab_property.R")
|
context("ab_property.R")
|
||||||
|
|
||||||
test_that("ab_property works", {
|
test_that("ab_property works", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
expect_identical(ab_name("AMX"), "Amoxicillin")
|
expect_identical(ab_name("AMX"), "Amoxicillin")
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("age.R")
|
context("age.R")
|
||||||
|
|
||||||
test_that("age works", {
|
test_that("age works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(age(x = c("1980-01-01", "1985-01-01", "1990-01-01"),
|
expect_equal(age(x = c("1980-01-01", "1985-01-01", "1990-01-01"),
|
||||||
reference = "2019-01-01"),
|
reference = "2019-01-01"),
|
||||||
c(39, 34, 29))
|
c(39, 34, 29))
|
||||||
@ -47,6 +48,7 @@ test_that("age works", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test_that("age_groups works", {
|
test_that("age_groups works", {
|
||||||
|
skip_on_cran()
|
||||||
ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
|
ages <- c(3, 8, 16, 54, 31, 76, 101, 43, 21)
|
||||||
|
|
||||||
expect_equal(length(unique(age_groups(ages, 50))),
|
expect_equal(length(unique(age_groups(ages, 50))),
|
||||||
|
@ -22,5 +22,6 @@
|
|||||||
context("availability.R")
|
context("availability.R")
|
||||||
|
|
||||||
test_that("availability works", {
|
test_that("availability works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(class(availability(example_isolates)), "data.frame")
|
expect_equal(class(availability(example_isolates)), "data.frame")
|
||||||
})
|
})
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
context("bug_drug_combinations.R")
|
context("bug_drug_combinations.R")
|
||||||
|
|
||||||
test_that("bug_drug_combinations works", {
|
test_that("bug_drug_combinations works", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
b <- suppressWarnings(bug_drug_combinations(example_isolates))
|
b <- suppressWarnings(bug_drug_combinations(example_isolates))
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
context("count.R")
|
context("count.R")
|
||||||
|
|
||||||
test_that("counts work", {
|
test_that("counts work", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
expect_equal(count_resistant(example_isolates$AMX), count_R(example_isolates$AMX))
|
expect_equal(count_resistant(example_isolates$AMX), count_R(example_isolates$AMX))
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
context("data.R")
|
context("data.R")
|
||||||
|
|
||||||
test_that("data sets are valid", {
|
test_that("data sets are valid", {
|
||||||
|
skip_on_cran()
|
||||||
expect_true(check_dataset_integrity()) # in misc.R
|
expect_true(check_dataset_integrity()) # in misc.R
|
||||||
|
|
||||||
# IDs should always be unique
|
# IDs should always be unique
|
||||||
@ -52,6 +52,8 @@ test_that("data sets are valid", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test_that("creation of data sets is valid", {
|
test_that("creation of data sets is valid", {
|
||||||
|
skip_on_cran()
|
||||||
|
|
||||||
df <- create_MO_lookup()
|
df <- create_MO_lookup()
|
||||||
expect_lt(nrow(df[which(df$prevalence == 1), ]), nrow(df[which(df$prevalence == 2), ]))
|
expect_lt(nrow(df[which(df$prevalence == 1), ]), nrow(df[which(df$prevalence == 2), ]))
|
||||||
expect_lt(nrow(df[which(df$prevalence == 2), ]), nrow(df[which(df$prevalence == 3), ]))
|
expect_lt(nrow(df[which(df$prevalence == 2), ]), nrow(df[which(df$prevalence == 3), ]))
|
||||||
@ -67,8 +69,10 @@ test_that("creation of data sets is valid", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test_that("CoL version info works", {
|
test_that("CoL version info works", {
|
||||||
expect_identical(class(catalogue_of_life_version()),
|
skip_on_cran()
|
||||||
c("catalogue_of_life_version", "list"))
|
|
||||||
|
expect_identical(class(catalogue_of_life_version()),
|
||||||
|
c("catalogue_of_life_version", "list"))
|
||||||
|
|
||||||
expect_output(print(catalogue_of_life_version()))
|
expect_output(print(catalogue_of_life_version()))
|
||||||
})
|
})
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("deprecated.R")
|
context("deprecated.R")
|
||||||
|
|
||||||
test_that("deprecated functions work", {
|
test_that("deprecated functions work", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(suppressWarnings(portion_S(example_isolates$AMX)), proportion_S(example_isolates$AMX))
|
expect_equal(suppressWarnings(portion_S(example_isolates$AMX)), proportion_S(example_isolates$AMX))
|
||||||
expect_equal(suppressWarnings(portion_SI(example_isolates$AMX)), proportion_SI(example_isolates$AMX))
|
expect_equal(suppressWarnings(portion_SI(example_isolates$AMX)), proportion_SI(example_isolates$AMX))
|
||||||
expect_equal(suppressWarnings(portion_I(example_isolates$AMX)), proportion_I(example_isolates$AMX))
|
expect_equal(suppressWarnings(portion_I(example_isolates$AMX)), proportion_I(example_isolates$AMX))
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("disk.R")
|
context("disk.R")
|
||||||
|
|
||||||
test_that("disk works", {
|
test_that("disk works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_true(as.disk(8) == as.disk("8"))
|
expect_true(as.disk(8) == as.disk("8"))
|
||||||
expect_true(is.disk(as.disk(8)))
|
expect_true(is.disk(as.disk(8)))
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
context("first_isolate.R")
|
context("first_isolate.R")
|
||||||
|
|
||||||
test_that("first isolates work", {
|
test_that("first isolates work", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
# first isolates
|
# first isolates
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("g.test.R")
|
context("g.test.R")
|
||||||
|
|
||||||
test_that("G-test works", {
|
test_that("G-test works", {
|
||||||
|
skip_on_cran()
|
||||||
|
|
||||||
# GOODNESS-OF-FIT
|
# GOODNESS-OF-FIT
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("get_locale.R")
|
context("get_locale.R")
|
||||||
|
|
||||||
test_that("get_locale works", {
|
test_that("get_locale works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_identical(mo_genus("B_GRAMP", language = "pt"),
|
expect_identical(mo_genus("B_GRAMP", language = "pt"),
|
||||||
"(Gram positivos desconhecidos)")
|
"(Gram positivos desconhecidos)")
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ test_that("ggplot_rsi works", {
|
|||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
skip_if_not("ggplot2" %in% rownames(installed.packages()))
|
skip_if_not_installed("ggplot2")
|
||||||
|
|
||||||
library(dplyr)
|
library(dplyr)
|
||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("guess_ab_col.R")
|
context("guess_ab_col.R")
|
||||||
|
|
||||||
test_that("guess_ab_col works", {
|
test_that("guess_ab_col works", {
|
||||||
|
skip_on_cran()
|
||||||
|
|
||||||
expect_equal(guess_ab_col(example_isolates, "amox"),
|
expect_equal(guess_ab_col(example_isolates, "amox"),
|
||||||
"AMX")
|
"AMX")
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("join_microorganisms.R")
|
context("join_microorganisms.R")
|
||||||
|
|
||||||
test_that("joins work", {
|
test_that("joins work", {
|
||||||
|
skip_on_cran()
|
||||||
unjoined <- example_isolates
|
unjoined <- example_isolates
|
||||||
inner <- example_isolates %>% inner_join_microorganisms()
|
inner <- example_isolates %>% inner_join_microorganisms()
|
||||||
left <- example_isolates %>% left_join_microorganisms()
|
left <- example_isolates %>% left_join_microorganisms()
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("key_antibiotics.R")
|
context("key_antibiotics.R")
|
||||||
|
|
||||||
test_that("keyantibiotics work", {
|
test_that("keyantibiotics work", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(length(key_antibiotics(example_isolates, warnings = FALSE)), nrow(example_isolates))
|
expect_equal(length(key_antibiotics(example_isolates, warnings = FALSE)), nrow(example_isolates))
|
||||||
expect_false(all(is.na(key_antibiotics(example_isolates))))
|
expect_false(all(is.na(key_antibiotics(example_isolates))))
|
||||||
expect_true(key_antibiotics_equal("SSS", "SSS"))
|
expect_true(key_antibiotics_equal("SSS", "SSS"))
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("kurtosis.R")
|
context("kurtosis.R")
|
||||||
|
|
||||||
test_that("kurtosis works", {
|
test_that("kurtosis works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(kurtosis(example_isolates$age),
|
expect_equal(kurtosis(example_isolates$age),
|
||||||
3.549319,
|
3.549319,
|
||||||
tolerance = 0.00001)
|
tolerance = 0.00001)
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("like.R")
|
context("like.R")
|
||||||
|
|
||||||
test_that("`like` works", {
|
test_that("`like` works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_true(sum("test" %like% c("^t", "^s")) == 1)
|
expect_true(sum("test" %like% c("^t", "^s")) == 1)
|
||||||
expect_true("test" %like% "test")
|
expect_true("test" %like% "test")
|
||||||
expect_true("test" %like% "TEST")
|
expect_true("test" %like% "TEST")
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("mic.R")
|
context("mic.R")
|
||||||
|
|
||||||
test_that("mic works", {
|
test_that("mic works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_true(as.mic(8) == as.mic("8"))
|
expect_true(as.mic(8) == as.mic("8"))
|
||||||
expect_true(as.mic("1") > as.mic("<=0.0625"))
|
expect_true(as.mic("1") > as.mic("<=0.0625"))
|
||||||
expect_true(as.mic("1") < as.mic(">=32"))
|
expect_true(as.mic("1") < as.mic(">=32"))
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("misc.R")
|
context("misc.R")
|
||||||
|
|
||||||
test_that("percentages works", {
|
test_that("percentages works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(percentage(0.25), "25%")
|
expect_equal(percentage(0.25), "25%")
|
||||||
expect_equal(percentage(0.5), "50%")
|
expect_equal(percentage(0.5), "50%")
|
||||||
expect_equal(percentage(0.500, digits = 1), "50.0%")
|
expect_equal(percentage(0.500, digits = 1), "50.0%")
|
||||||
@ -32,6 +33,7 @@ test_that("percentages works", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test_that("functions missing in older R versions work", {
|
test_that("functions missing in older R versions work", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(strrep("A", 5), "AAAAA")
|
expect_equal(strrep("A", 5), "AAAAA")
|
||||||
expect_equal(strrep(c("A", "B"), c(5, 2)), c("AAAAA", "BB"))
|
expect_equal(strrep(c("A", "B"), c(5, 2)), c("AAAAA", "BB"))
|
||||||
expect_equal(trimws(" test "), "test")
|
expect_equal(trimws(" test "), "test")
|
||||||
@ -40,6 +42,7 @@ test_that("functions missing in older R versions work", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test_that("looking up ab columns works", {
|
test_that("looking up ab columns works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_warning(generate_warning_abs_missing(c("AMP", "AMX")))
|
expect_warning(generate_warning_abs_missing(c("AMP", "AMX")))
|
||||||
expect_warning(generate_warning_abs_missing(c("AMP", "AMX"), any = TRUE))
|
expect_warning(generate_warning_abs_missing(c("AMP", "AMX"), any = TRUE))
|
||||||
expect_warning(get_column_abx(example_isolates, hard_dependencies = "FUS"))
|
expect_warning(get_column_abx(example_isolates, hard_dependencies = "FUS"))
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
# ==================================================================== #
|
|
||||||
# TITLE #
|
|
||||||
# Antimicrobial Resistance (AMR) Analysis #
|
|
||||||
# #
|
|
||||||
# SOURCE #
|
|
||||||
# https://github.com/msberends/AMR #
|
|
||||||
# #
|
|
||||||
# LICENCE #
|
|
||||||
# (c) 2018-2020 Berends MS, Luz CF et al. #
|
|
||||||
# #
|
|
||||||
# This R package is free software; you can freely use and distribute #
|
|
||||||
# it for both personal and commercial purposes under the terms of the #
|
|
||||||
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
|
|
||||||
# the Free Software Foundation. #
|
|
||||||
# #
|
|
||||||
# We created this package for both routine data analysis and academic #
|
|
||||||
# research and it was publicly released in the hope that it will be #
|
|
||||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
|
||||||
# Visit our website for more info: https://msberends.github.io/AMR. #
|
|
||||||
# ==================================================================== #
|
|
@ -22,6 +22,7 @@
|
|||||||
context("p_symbol.R")
|
context("p_symbol.R")
|
||||||
|
|
||||||
test_that("P symbol works", {
|
test_that("P symbol works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_identical(p_symbol(c(0.001, 0.01, 0.05, 0.1, 1, NA, 3)),
|
expect_identical(p_symbol(c(0.001, 0.01, 0.05, 0.1, 1, NA, 3)),
|
||||||
c("***", "**", "*", ".", " ", NA, NA))
|
c("***", "**", "*", ".", " ", NA, NA))
|
||||||
})
|
})
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("resistance_predict.R")
|
context("resistance_predict.R")
|
||||||
|
|
||||||
test_that("prediction of rsi works", {
|
test_that("prediction of rsi works", {
|
||||||
|
skip_on_cran()
|
||||||
AMX_R <- example_isolates %>%
|
AMX_R <- example_isolates %>%
|
||||||
filter(mo == "B_ESCHR_COLI") %>%
|
filter(mo == "B_ESCHR_COLI") %>%
|
||||||
rsi_predict(col_ab = "AMX",
|
rsi_predict(col_ab = "AMX",
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
context("rsi.R")
|
context("rsi.R")
|
||||||
|
|
||||||
test_that("rsi works", {
|
test_that("rsi works", {
|
||||||
|
|
||||||
skip_on_cran()
|
skip_on_cran()
|
||||||
|
|
||||||
expect_true(as.rsi("S") < as.rsi("I"))
|
expect_true(as.rsi("S") < as.rsi("I"))
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
context("skewness.R")
|
context("skewness.R")
|
||||||
|
|
||||||
test_that("skewness works", {
|
test_that("skewness works", {
|
||||||
|
skip_on_cran()
|
||||||
expect_equal(skewness(example_isolates$age),
|
expect_equal(skewness(example_isolates$age),
|
||||||
-0.8958019,
|
-0.8958019,
|
||||||
tolerance = 0.00001)
|
tolerance = 0.00001)
|
||||||
|
Loading…
Reference in New Issue
Block a user