mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 07:26:12 +01:00
(v1.3.0.9036) documentation fix
This commit is contained in:
parent
4e0374af29
commit
ac1c78c793
@ -1,6 +1,6 @@
|
||||
Package: AMR
|
||||
Version: 1.3.0.9035
|
||||
Date: 2020-09-29
|
||||
Version: 1.3.0.9036
|
||||
Date: 2020-09-30
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
person(role = c("aut", "cre"),
|
||||
|
4
NEWS.md
4
NEWS.md
@ -1,5 +1,5 @@
|
||||
# AMR 1.3.0.9035
|
||||
## <small>Last updated: 29 September 2020</small>
|
||||
# AMR 1.3.0.9036
|
||||
## <small>Last updated: 30 September 2020</small>
|
||||
|
||||
Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt to. We are those reviewers very grateful for going through our code so thoroughly!
|
||||
|
||||
|
9
R/rsi.R
9
R/rsi.R
@ -95,6 +95,11 @@
|
||||
#' @examples
|
||||
#' summary(example_isolates) # see all R/SI results at a glance
|
||||
#'
|
||||
#' if (require("skimr")) {
|
||||
#' # support for skim() too:
|
||||
#' skim(example_isolates)
|
||||
#' }
|
||||
#'
|
||||
#' # For INTERPRETING disk diffusion and MIC values -----------------------
|
||||
#'
|
||||
#' # a whole data set, even with combined MIC values and disk zones
|
||||
@ -124,7 +129,7 @@
|
||||
#' df %>% mutate_if(function(x) is.mic(x) | is.disk(x), as.rsi)
|
||||
#' df %>% mutate(across(where(is.mic), as.rsi))
|
||||
#' df %>% mutate_at(vars(AMP:TOB), as.rsi)
|
||||
#' df %>% mutate(across(AMP:TOB), as.rsi)
|
||||
#' df %>% mutate(across(AMP:TOB, as.rsi))
|
||||
#'
|
||||
#' df %>%
|
||||
#' mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli")
|
||||
@ -168,7 +173,7 @@
|
||||
#'
|
||||
#' # note: from dplyr 1.0.0 on, this will be:
|
||||
#' # example_isolates %>%
|
||||
#' # mutate(across(is.rsi.eligible, as.rsi))
|
||||
#' # mutate(across(where(is.rsi.eligible), as.rsi))
|
||||
#' }
|
||||
#' }
|
||||
as.rsi <- function(x, ...) {
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<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.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -43,7 +43,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -236,13 +236,13 @@
|
||||
<small>Source: <a href='https://github.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1309035" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.3.0.9035">
|
||||
<a href="#amr-1309035" class="anchor"></a>AMR 1.3.0.9035<small> Unreleased </small>
|
||||
<div id="amr-1309036" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.3.0.9036">
|
||||
<a href="#amr-1309036" class="anchor"></a>AMR 1.3.0.9036<small> Unreleased </small>
|
||||
</h1>
|
||||
<div id="last-updated-29-september-2020" class="section level2">
|
||||
<div id="last-updated-30-september-2020" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
<a href="#last-updated-29-september-2020" class="anchor"></a><small>Last updated: 29 September 2020</small>
|
||||
<a href="#last-updated-30-september-2020" class="anchor"></a><small>Last updated: 30 September 2020</small>
|
||||
</h2>
|
||||
<p>Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt to. We are those reviewers very grateful for going through our code so thoroughly!</p>
|
||||
<div id="breaking" class="section level3">
|
||||
|
@ -2,7 +2,7 @@ pandoc: 2.7.3
|
||||
pkgdown: 1.5.1.9000
|
||||
pkgdown_sha: eae56f08694abebf93cdfc0dd8e9ede06d8c815f
|
||||
articles: []
|
||||
last_built: 2020-09-29T21:35Z
|
||||
last_built: 2020-09-30T08:23Z
|
||||
urls:
|
||||
reference: https://msberends.github.io/AMR/reference
|
||||
article: https://msberends.github.io/AMR/articles
|
||||
|
@ -82,7 +82,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -413,6 +413,11 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
|
||||
<pre class="examples"><span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='kw'>example_isolates</span>) <span class='co'># see all R/SI results at a glance</span>
|
||||
|
||||
<span class='co'>if</span> (<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='st'><a href='https://docs.ropensci.org/skimr'>"skimr"</a></span>)) {
|
||||
<span class='co'># support for skim() too:</span>
|
||||
<span class='fu'><a href='https://docs.ropensci.org/skimr/reference/skim.html'>skim</a></span>(<span class='kw'>example_isolates</span>)
|
||||
}
|
||||
|
||||
<span class='co'># For INTERPRETING disk diffusion and MIC values -----------------------</span>
|
||||
|
||||
<span class='co'># a whole data set, even with combined MIC values and disk zones</span>
|
||||
@ -442,7 +447,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_if</a></span>(<span class='fu'>function</span>(<span class='kw'>x</span>) <span class='fu'><a href='as.mic.html'>is.mic</a></span>(<span class='kw'>x</span>) <span class='op'>|</span> <span class='fu'><a href='as.disk.html'>is.disk</a></span>(<span class='kw'>x</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='fu'>where</span>(<span class='kw'>is.mic</span>), <span class='kw'>as.rsi</span>))
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>)
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span> <span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate.html'>mutate</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/across.html'>across</a></span>(<span class='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>, <span class='kw'>as.rsi</span>))
|
||||
|
||||
<span class='kw'>df</span> <span class='op'>%>%</span>
|
||||
<span class='fu'><a href='https://dplyr.tidyverse.org/reference/mutate_all.html'>mutate_at</a></span>(<span class='fu'><a href='https://dplyr.tidyverse.org/reference/vars.html'>vars</a></span>(<span class='kw'>AMP</span><span class='op'>:</span><span class='kw'>TOB</span>), <span class='kw'>as.rsi</span>, mo = <span class='st'>"E. coli"</span>)
|
||||
@ -485,7 +490,7 @@ The <a href='lifecycle.html'>lifecycle</a> of this function is <strong>stable</s
|
||||
|
||||
<span class='co'># note: from dplyr 1.0.0 on, this will be: </span>
|
||||
<span class='co'># example_isolates %>%</span>
|
||||
<span class='co'># mutate(across(is.rsi.eligible, as.rsi))</span>
|
||||
<span class='co'># mutate(across(where(is.rsi.eligible), as.rsi))</span>
|
||||
}
|
||||
<span class='co'># }</span>
|
||||
</pre>
|
||||
|
@ -81,7 +81,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,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">1.3.0.9035</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.3.0.9036</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -156,6 +156,11 @@ On our website \url{https://msberends.github.io/AMR} you can find \href{https://
|
||||
\examples{
|
||||
summary(example_isolates) # see all R/SI results at a glance
|
||||
|
||||
if (require("skimr")) {
|
||||
# support for skim() too:
|
||||
skim(example_isolates)
|
||||
}
|
||||
|
||||
# For INTERPRETING disk diffusion and MIC values -----------------------
|
||||
|
||||
# a whole data set, even with combined MIC values and disk zones
|
||||
@ -185,7 +190,7 @@ if (require("dplyr")) {
|
||||
df \%>\% mutate_if(function(x) is.mic(x) | is.disk(x), as.rsi)
|
||||
df \%>\% mutate(across(where(is.mic), as.rsi))
|
||||
df \%>\% mutate_at(vars(AMP:TOB), as.rsi)
|
||||
df \%>\% mutate(across(AMP:TOB), as.rsi)
|
||||
df \%>\% mutate(across(AMP:TOB, as.rsi))
|
||||
|
||||
df \%>\%
|
||||
mutate_at(vars(AMP:TOB), as.rsi, mo = "E. coli")
|
||||
@ -228,7 +233,7 @@ if (require("dplyr")) {
|
||||
|
||||
# note: from dplyr 1.0.0 on, this will be:
|
||||
# example_isolates \%>\%
|
||||
# mutate(across(is.rsi.eligible, as.rsi))
|
||||
# mutate(across(where(is.rsi.eligible), as.rsi))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
tests/testthat/test-_all_examples.R → tests/testthat/test-_deprecated.R
Executable file → Normal file
7
tests/testthat/test-_all_examples.R → tests/testthat/test-_deprecated.R
Executable file → Normal file
@ -18,3 +18,10 @@
|
||||
# useful, but it comes WITHOUT ANY WARRANTY OR LIABILITY. #
|
||||
# Visit our website for more info: https://msberends.github.io/AMR. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("deprecated.R")
|
||||
|
||||
test_that("deprecated functions work", {
|
||||
skip_on_cran()
|
||||
# if some functions get deprecated, put the tests here
|
||||
})
|
@ -19,7 +19,7 @@
|
||||
# Visit our website for more info: https://msberends.github.io/AMR. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("misc.R")
|
||||
context("aa_helper_functions.R")
|
||||
|
||||
test_that("percentages works", {
|
||||
skip_on_cran()
|
||||
@ -50,3 +50,40 @@ test_that("looking up ab columns works", {
|
||||
expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = TRUE))
|
||||
expect_warning(get_column_abx(dplyr::rename(example_isolates, thisone = AMX), amox = "thisone", tmp = "thisone", verbose = FALSE))
|
||||
})
|
||||
|
||||
test_that("imports work", {
|
||||
skip_on_cran()
|
||||
|
||||
import_functions <- c(
|
||||
"anti_join" = "dplyr",
|
||||
"cur_column" = "dplyr",
|
||||
"freq.default" = "cleaner",
|
||||
"full_join" = "dplyr",
|
||||
"has_internet" = "curl",
|
||||
"html_attr" = "rvest",
|
||||
"html_children" = "rvest",
|
||||
"html_node" = "rvest",
|
||||
"html_nodes" = "rvest",
|
||||
"html_table" = "rvest",
|
||||
"html_text" = "rvest",
|
||||
"inline_hist" = "skimr",
|
||||
"inner_join" = "dplyr",
|
||||
"insertText" = "rstudioapi",
|
||||
"left_join" = "dplyr",
|
||||
"new_pillar_shaft_simple" = "pillar",
|
||||
"peek_mask" = "dplyr",
|
||||
"peek_vars" = "tidyselect",
|
||||
"read_excel" = "readxl",
|
||||
"read_html" = "xml2",
|
||||
"right_join" = "dplyr",
|
||||
"semi_join" = "dplyr",
|
||||
"sfl" = "skimr",
|
||||
"showQuestion" = "rstudioapi")
|
||||
|
||||
for (i in seq_len(length(import_functions))) {
|
||||
fn <- names(import_functions)[i]
|
||||
pkg <- unname(import_functions[i])
|
||||
expect(!is.null(import_fn(name = fn, pkg = pkg, error_on_fail = FALSE)),
|
||||
failure_message = paste0("Function ", pkg, "::", fn, "() does not exist"))
|
||||
}
|
||||
})
|
@ -1,31 +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. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("deprecated.R")
|
||||
|
||||
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_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_IR(example_isolates$AMX)), proportion_IR(example_isolates$AMX))
|
||||
expect_equal(suppressWarnings(portion_R(example_isolates$AMX)), proportion_R(example_isolates$AMX))
|
||||
})
|
@ -1,49 +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. #
|
||||
# ==================================================================== #
|
||||
|
||||
context("import_fn.R")
|
||||
|
||||
test_that("imports work", {
|
||||
skip_on_cran()
|
||||
|
||||
import_functions <- c(
|
||||
cleaner = "freq.default",
|
||||
curl = "has_internet",
|
||||
dplyr = "cur_column",
|
||||
dplyr = "peek_mask",
|
||||
readxl = "read_excel",
|
||||
rstudioapi = "showQuestion",
|
||||
rvest = "html_attr",
|
||||
rvest = "html_children",
|
||||
rvest = "html_node",
|
||||
rvest = "html_nodes",
|
||||
rvest = "html_table",
|
||||
rvest = "html_text",
|
||||
tidyselect = "peek_vars",
|
||||
xml2 = "read_html")
|
||||
|
||||
for (i in seq_len(length(import_functions))) {
|
||||
pkg <- names(import_functions)[i]
|
||||
fn <- unname(import_functions[i])
|
||||
expect(!is.null(import_fn(name = fn, pkg = pkg, error_on_fail = FALSE)),
|
||||
failure_message = paste0("Function ", pkg, "::", fn, "() does not exist"))
|
||||
}
|
||||
})
|
@ -40,6 +40,7 @@ test_that("mic works", {
|
||||
expect_s3_class(c(x[1], x[9]), "mic")
|
||||
expect_s3_class(unique(x[1], x[9]), "mic")
|
||||
expect_warning(as.mic("INVALID VALUE"))
|
||||
|
||||
|
||||
pdf(NULL) # prevent Rplots.pdf being created
|
||||
expect_silent(barplot(as.mic(c(1, 2, 4, 8))))
|
||||
|
Loading…
Reference in New Issue
Block a user