mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 06:06:12 +01:00
(v1.0.1.9007) small bugfix
This commit is contained in:
parent
7a6f819232
commit
cde65141d9
@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 1.0.1.9006
|
||||
Version: 1.0.1.9007
|
||||
Date: 2020-04-14
|
||||
Title: Antimicrobial Resistance Analysis
|
||||
Authors@R: c(
|
||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
||||
# AMR 1.0.1.9006
|
||||
# AMR 1.0.1.9007
|
||||
## <small>Last updated: 14-Apr-2020</small>
|
||||
|
||||
### New
|
||||
|
44
R/mo.R
44
R/mo.R
@ -178,7 +178,7 @@ as.mo <- function(x,
|
||||
check_dataset_integrity()
|
||||
|
||||
# start off with replaced language-specific non-ASCII characters with ASCII characters
|
||||
x <- parse_encoding(x)
|
||||
x <- parse_and_convert(x)
|
||||
|
||||
# WHONET: xxx = no growth
|
||||
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
|
||||
@ -263,7 +263,7 @@ exec_as.mo <- function(x,
|
||||
check_dataset_integrity()
|
||||
|
||||
# start off with replaced language-specific non-ASCII characters with ASCII characters
|
||||
x <- parse_encoding(x)
|
||||
x <- parse_and_convert(x)
|
||||
|
||||
# WHONET: xxx = no growth
|
||||
x[tolower(as.character(paste0(x, ""))) %in% c("", "xxx", "na", "nan")] <- NA_character_
|
||||
@ -277,27 +277,7 @@ exec_as.mo <- function(x,
|
||||
options(mo_renamed = NULL)
|
||||
}
|
||||
options(mo_renamed_last_run = NULL)
|
||||
|
||||
if (NCOL(x) == 2) {
|
||||
# support tidyverse selection like: df %>% select(colA, colB)
|
||||
# paste these columns together
|
||||
x_vector <- vector("character", NROW(x))
|
||||
for (i in seq_len(NROW(x))) {
|
||||
x_vector[i] <- paste(pull(x[i, ], 1), pull(x[i, ], 2), sep = " ")
|
||||
}
|
||||
x <- x_vector
|
||||
} else {
|
||||
if (NCOL(x) > 2) {
|
||||
stop("`x` can be 2 columns at most", call. = FALSE)
|
||||
}
|
||||
x[is.null(x)] <- NA
|
||||
|
||||
# support tidyverse selection like: df %>% select(colA)
|
||||
if (!is.vector(x) & !is.null(dim(x))) {
|
||||
x <- pull(x, 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uncertainties <- data.frame(uncertainty = integer(0),
|
||||
input = character(0),
|
||||
fullname = character(0),
|
||||
@ -1977,9 +1957,23 @@ trimws2 <- function(x) {
|
||||
trimws(gsub("[\\s]+", " ", x, perl = TRUE))
|
||||
}
|
||||
|
||||
parse_encoding <- function(x) {
|
||||
parse_and_convert <- function(x) {
|
||||
tryCatch({
|
||||
x <- unname(unlist(x))
|
||||
if (!is.null(dim(x))) {
|
||||
if (NCOL(x) > 2) {
|
||||
stop("A maximum of two columns is allowed.", call. = FALSE)
|
||||
} else if (NCOL(x) == 2) {
|
||||
# support tidyverse selection like: df %>% select(colA, colB)
|
||||
# paste these columns together
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)
|
||||
colnames(x) <- c("A", "B")
|
||||
x <- paste(x$A, x$B)
|
||||
} else {
|
||||
# support tidyverse selection like: df %>% select(colA)
|
||||
x <- as.data.frame(x, stringsAsFactors = FALSE)[[1]]
|
||||
}
|
||||
}
|
||||
x[is.null(x)] <- NA
|
||||
parsed <- iconv(x, to = "UTF-8")
|
||||
parsed[is.na(parsed) & !is.na(x)] <- iconv(x[is.na(parsed) & !is.na(x)], from = "Latin1", to = "ASCII//TRANSLIT")
|
||||
parsed <- gsub('"', "", parsed, fixed = TRUE)
|
||||
|
@ -81,7 +81,7 @@
|
||||
</button>
|
||||
<span class="navbar-brand">
|
||||
<a class="navbar-link" href="https://msberends.gitlab.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.0.1.9006</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9007</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.0.1.9006</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9007</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.0.1.9006</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9007</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.0.1.9006</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9007</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.0.1.9006</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9007</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.0.1.9006</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9007</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -229,9 +229,9 @@
|
||||
<small>Source: <a href='https://gitlab.com/msberends/AMR/blob/master/NEWS.md'><code>NEWS.md</code></a></small>
|
||||
</div>
|
||||
|
||||
<div id="amr-1019006" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.0.1.9006">
|
||||
<a href="#amr-1019006" class="anchor"></a>AMR 1.0.1.9006<small> Unreleased </small>
|
||||
<div id="amr-1019007" class="section level1">
|
||||
<h1 class="page-header" data-toc-text="1.0.1.9007">
|
||||
<a href="#amr-1019007" class="anchor"></a>AMR 1.0.1.9007<small> Unreleased </small>
|
||||
</h1>
|
||||
<div id="last-updated-14-apr-2020" class="section level2">
|
||||
<h2 class="hasAnchor">
|
||||
|
@ -10,7 +10,7 @@ articles:
|
||||
WHONET: WHONET.html
|
||||
benchmarks: benchmarks.html
|
||||
resistance_predict: resistance_predict.html
|
||||
last_built: 2020-04-14T12:12Z
|
||||
last_built: 2020-04-14T12:56Z
|
||||
urls:
|
||||
reference: https://msberends.gitlab.io/AMR/reference
|
||||
article: https://msberends.gitlab.io/AMR/articles
|
||||
|
@ -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.0.1.9006</span>
|
||||
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Latest development version">1.0.1.9007</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user