diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml
index 0fb9fb97..56779b0e 100644
--- a/.github/workflows/check.yaml
+++ b/.github/workflows/check.yaml
@@ -120,16 +120,7 @@ jobs:
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- - name: Check on older R versions
- # no vignettes here, since they rely on R 3.3 and higher
- if: matrix.config.r == '3.2'
- env:
- _R_CHECK_CRAN_INCOMING_: false
- run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--ignore-vignettes"), build_args = "--no-build-vignettes" , error_on = "warning", check_dir = "check")
- shell: Rscript {0}
-
- - name: Check on newer R versions
- if: matrix.config.r != '3.2'
+ - name: Run Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
diff --git a/.github/workflows/codecovr.yaml b/.github/workflows/codecovr.yaml
index 62aa728e..ad03f567 100644
--- a/.github/workflows/codecovr.yaml
+++ b/.github/workflows/codecovr.yaml
@@ -67,5 +67,5 @@ jobs:
shell: Rscript {0}
- name: Test coverage
- run: covr::codecov(line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"), quiet = FALSE)
+ run: covr::codecov(line_exclusions = list("R/atc_online.R", "R/mo_source.R", "R/translate.R", "R/resistance_predict.R", "R/aa_helper_functions.R", "R/aa_helper_pm_functions.R", "R/zzz.R"), quiet = FALSE)
shell: Rscript {0}
diff --git a/DESCRIPTION b/DESCRIPTION
index 4b8334d7..494c8ac9 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: AMR
-Version: 1.4.0.9038
+Version: 1.4.0.9039
Date: 2020-12-13
Title: Antimicrobial Resistance Analysis
Authors@R: c(
diff --git a/NEWS.md b/NEWS.md
index 016ed0f5..ab499e7b 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# AMR 1.4.0.9038
+# AMR 1.4.0.9039
## Last updated: 13 December 2020
### New
diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R
index 9c208bc2..18b55a4c 100755
--- a/R/aa_helper_functions.R
+++ b/R/aa_helper_functions.R
@@ -187,7 +187,7 @@ search_type_in_df <- function(x, type, info = TRUE) {
}
if (!is.null(found) & info == TRUE) {
- msg <- paste0("Using column '", found, "' as input for `col_", type, "`.")
+ msg <- paste0("Using column '", font_bold(found), "' as input for `col_", type, "`.")
if (type %in% c("keyantibiotics", "specimen")) {
msg <- paste(msg, "Use", font_bold(paste0("col_", type), "= FALSE"), "to prevent this.")
}
diff --git a/R/pca.R b/R/pca.R
index 334eaaa7..1e2c2bc8 100755
--- a/R/pca.R
+++ b/R/pca.R
@@ -111,7 +111,7 @@ pca <- function(x,
x <- cbind(x.bak[, sapply(x.bak, function(y) !is.numeric(y) & !all(is.na(y))), drop = FALSE], x)
}
- x <- pm_ungroup(x) # would otherwise select the grouping vars
+ x <- pm_ungroup(x) # would otherwise select the grouping vars
x <- x[rowSums(is.na(x)) == 0, ] # remove columns containing NAs
pca_data <- x[, which(sapply(x, function(x) is.numeric(x)))]
diff --git a/R/random.R b/R/random.R
index 24d51f73..0e1ee272 100644
--- a/R/random.R
+++ b/R/random.R
@@ -130,4 +130,3 @@ random_exec <- function(type, size, mo = NULL, ab = NULL) {
return(as.disk(out))
}
}
-
diff --git a/R/rsi.R b/R/rsi.R
index f75f577b..f0cd96e1 100755
--- a/R/rsi.R
+++ b/R/rsi.R
@@ -316,22 +316,21 @@ as.rsi.mic <- function(x,
# for auto-determining mo
mo_var_found <- ""
if (is.null(mo)) {
- peek_mask_dplyr <- import_fn("peek_mask", "dplyr", error_on_fail = FALSE)
- if (!is.null(peek_mask_dplyr)) {
+ tryCatch({
+ df <- get_current_data(arg_name = "mo", call = -3) # will return an error if not found
+ mo <- NULL
try({
- df <- as.data.frame(peek_mask_dplyr()$across_cols(), stringsAsFactors = FALSE)
mo <- suppressMessages(search_type_in_df(df, "mo"))
- if (!is.null(mo)) {
- mo_var_found <- paste0(" based on column `", font_bold(mo), "`")
- mo <- df[, mo, drop = TRUE]
- }
}, silent = TRUE)
- }
- }
- if (is.null(mo)) {
- stop_('No information was supplied about the microorganisms (missing parameter "mo"). See ?as.rsi.\n\n',
- "To transform certain columns with e.g. mutate_at(), use `data %>% mutate_at(vars(...), as.rsi, mo = .$x)`, where x is your column with microorganisms.\n",
- "To tranform all MIC values in a data set, use `data %>% as.rsi()` or data %>% mutate_if(is.mic, as.rsi).", call = FALSE)
+ if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
+ mo_var_found <- paste0(" based on column `", font_bold(mo), "`")
+ mo <- df[, mo, drop = TRUE]
+ }
+ }, error = function(e)
+ stop_('No information was supplied about the microorganisms (missing parameter "mo"). See ?as.rsi.\n\n',
+ "To transform certain columns with e.g. mutate_at(), use `data %>% mutate_at(vars(...), as.rsi, mo = .$x)`, where x is your column with microorganisms.\n",
+ "To tranform all disk diffusion zones in a data set, use `data %>% as.rsi()` or data %>% mutate_if(is.disk, as.rsi).", call = FALSE)
+ )
}
if (length(ab) == 1 && ab %like% "as.mic") {
stop_('No unambiguous name was supplied about the antibiotic (parameter "ab"). See ?as.rsi.', call = FALSE)
@@ -406,22 +405,21 @@ as.rsi.disk <- function(x,
# for auto-determining mo
mo_var_found <- ""
if (is.null(mo)) {
- peek_mask_dplyr <- import_fn("peek_mask", "dplyr", error_on_fail = FALSE)
- if (!is.null(peek_mask_dplyr)) {
+ tryCatch({
+ df <- get_current_data(arg_name = "mo", call = -3) # will return an error if not found
+ mo <- NULL
try({
- df <- as.data.frame(peek_mask_dplyr()$across_cols(), stringsAsFactors = FALSE)
mo <- suppressMessages(search_type_in_df(df, "mo"))
- if (!is.null(mo)) {
- mo_var_found <- paste0(" based on column `", font_bold(mo), "`")
- mo <- df[, mo, drop = TRUE]
- }
}, silent = TRUE)
- }
- }
- if (is.null(mo)) {
- stop_('No information was supplied about the microorganisms (missing parameter "mo"). See ?as.rsi.\n\n',
- "To transform certain columns with e.g. mutate_at(), use `data %>% mutate_at(vars(...), as.rsi, mo = .$x)`, where x is your column with microorganisms.\n",
- "To tranform all disk diffusion zones in a data set, use `data %>% as.rsi()` or data %>% mutate_if(is.disk, as.rsi).", call = FALSE)
+ if (!is.null(df) && !is.null(mo) && is.data.frame(df)) {
+ mo_var_found <- paste0(" based on column `", font_bold(mo), "`")
+ mo <- df[, mo, drop = TRUE]
+ }
+ }, error = function(e)
+ stop_('No information was supplied about the microorganisms (missing parameter "mo"). See ?as.rsi.\n\n',
+ "To transform certain columns with e.g. mutate_at(), use `data %>% mutate_at(vars(...), as.rsi, mo = .$x)`, where x is your column with microorganisms.\n",
+ "To tranform all disk diffusion zones in a data set, use `data %>% as.rsi()` or data %>% mutate_if(is.disk, as.rsi).", call = FALSE)
+ )
}
if (length(ab) == 1 && ab %like% "as.disk") {
stop_('No unambiguous name was supplied about the antibiotic (parameter "ab"). See ?as.rsi.', call = FALSE)
diff --git a/README.md b/README.md
index a38e91b7..efeca949 100755
--- a/README.md
+++ b/README.md
@@ -2,9 +2,8 @@
# `AMR` (for R)
-
-
-
+[![CRAN_Badge](https://www.r-pkg.org/badges/version-ago/AMR)](https://cran.R-project.org/package=AMR) [![CRAN_Downloads](https://cranlogs.r-pkg.org/badges/grand-total/AMR)](https://cran.R-project.org/package=AMR)
+[![CodeCov](https://codecov.io/gh/msberends/AMR/branch/master/graph/badge.svg)](https://codecov.io/gh/msberends/AMR/branch/master)
@@ -21,6 +20,8 @@ This is the development source of the `AMR` package for R. Not a developer? Then
### How to get this package
Please see [our website](https://msberends.github.io/AMR/#get-this-package).
+Bottom line: `install.packages("AMR")`
+
### Copyright
This R package is licensed under the [GNU General Public License (GPL) v2.0](https://github.com/msberends/AMR/blob/master/LICENSE). In a nutshell, this means that this package:
diff --git a/docs/404.html b/docs/404.html
index dbf886ae..43eb4ec6 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
NEWS.md
-