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

(v0.7.1.9100) bug_drug speed, MIC levels

This commit is contained in:
2019-10-08 22:21:33 +02:00
parent 683d226fd3
commit c8f6b97847
22 changed files with 117 additions and 70 deletions

34
R/mic.R
View File

@ -68,6 +68,9 @@ as.mic <- function(x, na.rm = FALSE) {
x <- gsub(',', '.', 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)
# starting dots must start with 0
x <- gsub('^[.]+', '0.', x)
# <=0.2560.512 should be 0.512
@ -76,13 +79,19 @@ as.mic <- function(x, na.rm = FALSE) {
x <- gsub('[.]+0$', '', x)
# remove all after last digit
x <- gsub('[^0-9]+$', '', x)
# keep only one zero before dot
x <- gsub("0+[.]", "0.", x)
# starting 00 is probably 0.0 if there's no dot yet
x[!x %like% "[.]"] <- gsub("^00", "0.0", x[!x %like% "[.]"])
# remove last zeroes
x <- gsub('([.].?)0+$', '\\1', x)
x <- gsub('(.*[.])0+$', '\\10', x)
# remove ending .0 again
x <- gsub('[.]+0$', '', x)
x[x %like% "[.]"] <- gsub('0+$', '', x[x %like% "[.]"])
# force to be character
x <- as.character(x)
# trim it
x <- trimws(x)
## previously unempty values now empty - should return a warning later on
x[x.bak != "" & x == ""] <- "invalid"
@ -92,15 +101,25 @@ as.mic <- function(x, na.rm = FALSE) {
"<0.002", "<=0.002", "0.002", ">=0.002", ">0.002",
"<0.003", "<=0.003", "0.003", ">=0.003", ">0.003",
"<0.004", "<=0.004", "0.004", ">=0.004", ">0.004",
"<0.005", "<=0.005", "0.005", ">=0.005", ">0.005",
"<0.006", "<=0.006", "0.006", ">=0.006", ">0.006",
"<0.007", "<=0.007", "0.007", ">=0.007", ">0.007",
"<0.008", "<=0.008", "0.008", ">=0.008", ">0.008",
"<0.009", "<=0.009", "0.009", ">=0.009", ">0.009",
"<0.01", "<=0.01", "0.01", ">=0.01", ">0.01",
"<0.012", "<=0.012", "0.012", ">=0.012", ">0.012",
"<0.0125", "<=0.0125", "0.0125", ">=0.0125", ">0.0125",
"<0.016", "<=0.016", "0.016", ">=0.016", ">0.016",
"<0.019", "<=0.019", "0.019", ">=0.019", ">0.019",
"<0.02", "<=0.02", "0.02", ">=0.02", ">0.02",
"<0.023", "<=0.023", "0.023", ">=0.023", ">0.023",
"<0.025", "<=0.025", "0.025", ">=0.025", ">0.025",
"<0.028", "<=0.028", "0.028", ">=0.028", ">0.028",
"<0.03", "<=0.03", "0.03", ">=0.03", ">0.03",
"<0.031", "<=0.031", "0.031", ">=0.031", ">0.031",
"<0.032", "<=0.032", "0.032", ">=0.032", ">0.032",
"<0.038", "<=0.038", "0.038", ">=0.038", ">0.038",
"<0.04", "<=0.04", "0.04", ">=0.04", ">0.04",
"<0.047", "<=0.047", "0.047", ">=0.047", ">0.047",
"<0.05", "<=0.05", "0.05", ">=0.05", ">0.05",
"<0.054", "<=0.054", "0.054", ">=0.054", ">0.054",
@ -108,25 +127,38 @@ as.mic <- function(x, na.rm = FALSE) {
"<0.0625", "<=0.0625", "0.0625", ">=0.0625", ">0.0625",
"<0.063", "<=0.063", "0.063", ">=0.063", ">0.063",
"<0.064", "<=0.064", "0.064", ">=0.064", ">0.064",
"<0.075", "<=0.075", "0.075", ">=0.075", ">0.075",
"<0.08", "<=0.08", "0.08", ">=0.08", ">0.08",
"<0.09", "<=0.09", "0.09", ">=0.09", ">0.09",
"<0.094", "<=0.094", "0.094", ">=0.094", ">0.094",
"<0.095", "<=0.095", "0.095", ">=0.095", ">0.095",
"<0.1", "<=0.1", "0.1", ">=0.1", ">0.1",
"<0.12", "<=0.12", "0.12", ">=0.12", ">0.12",
"<0.125", "<=0.125", "0.125", ">=0.125", ">0.125",
"<0.128", "<=0.128", "0.128", ">=0.128", ">0.128",
"<0.15", "<=0.15", "0.15", ">=0.15", ">0.15",
"<0.16", "<=0.16", "0.16", ">=0.16", ">0.16",
"<0.17", "<=0.17", "0.17", ">=0.17", ">0.17",
"<0.18", "<=0.18", "0.18", ">=0.18", ">0.18",
"<0.19", "<=0.19", "0.19", ">=0.19", ">0.19",
"<0.2", "<=0.2", "0.2", ">=0.2", ">0.2",
"<0.23", "<=0.23", "0.23", ">=0.23", ">0.23",
"<0.25", "<=0.25", "0.25", ">=0.25", ">0.25",
"<0.256", "<=0.256", "0.256", ">=0.256", ">0.256",
"<0.28", "<=0.28", "0.28", ">=0.28", ">0.28",
"<0.3", "<=0.3", "0.3", ">=0.3", ">0.3",
"<0.32", "<=0.32", "0.32", ">=0.32", ">0.32",
"<0.35", "<=0.35", "0.35", ">=0.35", ">0.35",
"<0.36", "<=0.36", "0.36", ">=0.36", ">0.36",
"<0.38", "<=0.38", "0.38", ">=0.38", ">0.38",
"<0.47", "<=0.47", "0.47", ">=0.47", ">0.47",
"<0.5", "<=0.5", "0.5", ">=0.5", ">0.5",
"<0.512", "<=0.512", "0.512", ">=0.512", ">0.512",
"<0.64", "<=0.64", "0.64", ">=0.64", ">0.64",
"<0.73", "<=0.73", "0.73", ">=0.73", ">0.73",
"<0.75", "<=0.75", "0.75", ">=0.75", ">0.75",
"<0.8", "<=0.8", "0.8", ">=0.8", ">0.8",
"<0.94", "<=0.94", "0.94", ">=0.94", ">0.94",
"<1", "<=1", "1", ">=1", ">1",
"<1.5", "<=1.5", "1.5", ">=1.5", ">1.5",
"<2", "<=2", "2", ">=2", ">2",