diff --git a/DESCRIPTION b/DESCRIPTION
index 1da3c8c5..fbdb612a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: AMR
-Version: 1.4.0.9015
+Version: 1.4.0.9016
Date: 2020-11-10
Title: Antimicrobial Resistance Analysis
Authors@R: c(
diff --git a/NEWS.md b/NEWS.md
index ec6de640..f17103b0 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# AMR 1.4.0.9015
+# AMR 1.4.0.9016
## Last updated: 10 November 2020
### New
@@ -16,6 +16,7 @@
* Better determination of disk zones and MIC values when running `as.rsi()` on a data.frame
* Updated coagulase-negative staphylococci determination with Becker *et al.* 2020 (PMID 32056452), meaning that the species *S. argensis*, *S. caeli*, *S. debuckii*, *S. edaphicus* and *S. pseudoxylosus* are now all considered CoNS
* Fix for using parameter `reference_df` in `as.mo()` and `mo_*()` functions that contain old microbial codes (from previous package versions)
+* Fix for using `as.rsi()` on a data.frame in older R versions
### Other
* All messages and warnings thrown by this package now break sentences on whole words
diff --git a/R/aa_helper_functions.R b/R/aa_helper_functions.R
index c7d8332d..91ca9ed3 100755
--- a/R/aa_helper_functions.R
+++ b/R/aa_helper_functions.R
@@ -313,7 +313,9 @@ word_wrap <- function(...,
}
msg <- gsub("\n", paste0("\n", strrep(" ", indentation)), msg, fixed = TRUE)
msg <- gsub("*|*", paste0("*|*", strrep(" ", indentation)), msg, fixed = TRUE)
-
+ # remove trailing empty characters
+ msg <- gsub("(\n| )+$", "", msg)
+
if (length(add_fn) > 0) {
if (!is.list(add_fn)) {
add_fn <- list(add_fn)
diff --git a/R/rsi.R b/R/rsi.R
index b92540b0..3299f9d4 100755
--- a/R/rsi.R
+++ b/R/rsi.R
@@ -469,6 +469,13 @@ as.rsi.data.frame <- function(x,
meet_criteria(conserve_capped_values, allow_class = "logical", has_length = 1)
meet_criteria(add_intrinsic_resistance, allow_class = "logical", has_length = 1)
+ for (i in seq_len(ncol(x))) {
+ # don't keep factors
+ if (is.factor(x[, i, drop = TRUE])) {
+ x[, i] <- as.character(x[, i, drop = TRUE])
+ }
+ }
+
# -- MO
col_mo.bak <- col_mo
if (is.null(col_mo)) {
diff --git a/docs/404.html b/docs/404.html
index d49e45e8..53cdaf62 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
NEWS.md
-
as.rsi()
on a data.framereference_df
in as.mo()
and mo_*()
functions that contain old microbial codes (from previous package versions)as.rsi()
on a data.frame in older R versions