1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 07:51:57 +02:00

(v0.9.0.9029) add uti to as.rsi()

This commit is contained in:
2020-02-20 13:19:23 +01:00
parent a5db82c2fb
commit c6184a0fb8
71 changed files with 1129 additions and 800 deletions

10
R/mic.R
View File

@ -65,11 +65,14 @@ as.mic <- function(x, na.rm = FALSE) {
# comma to period
x <- gsub(",", ".", x, fixed = TRUE)
# transform Unicode for >= and <=
x <- gsub("\u2264", "<=", x, fixed = TRUE)
x <- gsub("\u2265", ">=", x, fixed = TRUE)
# remove space between operator and number ("<= 0.002" -> "<=0.002")
x <- gsub("(<|=|>) +", "\\1", x)
# transform => to >= and =< to <=
x <- gsub("=>", ">=", x, fixed = TRUE)
x <- gsub("=<", "<=", x, fixed = TRUE)
x <- gsub("=>", ">=", x, fixed = TRUE)
# starting dots must start with 0
x <- gsub("^[.]+", "0.", x)
# <=0.2560.512 should be 0.512
@ -126,6 +129,11 @@ as.mic <- function(x, na.rm = FALSE) {
}
}
all_valid_mics <- function(x) {
x_mic <- suppressWarnings(as.mic(x[!is.na(x)]))
!any(is.na(x_mic)) & !all(is.na(x))
}
#' @rdname as.mic
#' @export
#' @importFrom dplyr %>%