mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 16:42:10 +02:00
(v1.5.0.9033) as.rsi fix
This commit is contained in:
2
R/mic.R
2
R/mic.R
@ -341,7 +341,7 @@ get_skimmers.mic <- function(column) {
|
||||
skim_type = "mic",
|
||||
min = ~min(., na.rm = TRUE),
|
||||
max = ~max(., na.rm = TRUE),
|
||||
median = ~median(., na.rm = TRUE),
|
||||
median = ~stats::median(., na.rm = TRUE),
|
||||
n_unique = ~pm_n_distinct(., na.rm = TRUE),
|
||||
hist_log2 = ~skimr::inline_hist(log2(stats::na.omit(.)))
|
||||
)
|
||||
|
1
R/plot.R
1
R/plot.R
@ -527,7 +527,6 @@ plot_colours_subtitle_guideline <- function(x, mo, ab, guideline, colours_RSI, f
|
||||
list(cols = cols, count = as.double(x), sub = sub, guideline = guideline)
|
||||
}
|
||||
|
||||
|
||||
#' @method plot rsi
|
||||
#' @export
|
||||
#' @importFrom graphics plot text axis
|
||||
|
13
R/rsi.R
13
R/rsi.R
@ -814,17 +814,14 @@ exec_as.rsi <- function(method,
|
||||
if (is.na(x[i])) {
|
||||
new_rsi[i] <- NA_character_
|
||||
} else if (method == "mic") {
|
||||
mic_input <- x[i]
|
||||
mic_S <- as.mic(get_record$breakpoint_S)
|
||||
mic_R <- as.mic(get_record$breakpoint_R)
|
||||
new_rsi[i] <- quick_case_when(isTRUE(conserve_capped_values) & mic_input %like% "^<[0-9]" ~ "S",
|
||||
isTRUE(conserve_capped_values) & mic_input %like% "^>[0-9]" ~ "R",
|
||||
new_rsi[i] <- quick_case_when(isTRUE(conserve_capped_values) & x[i] %like% "^<[0-9]" ~ "S",
|
||||
isTRUE(conserve_capped_values) & x[i] %like% "^>[0-9]" ~ "R",
|
||||
# start interpreting: EUCAST uses <= S and > R, CLSI uses <=S and >= R
|
||||
isTRUE(which(levels(mic_input) == mic_input) <= which(levels(mic_S) == mic_S)) ~ "S",
|
||||
isTRUE(x[i] <= get_record$breakpoint_S) ~ "S",
|
||||
guideline_coerced %like% "EUCAST" &
|
||||
isTRUE(which(levels(mic_input) == mic_input) > which(levels(mic_R) == mic_R)) ~ "R",
|
||||
isTRUE(x[i] > get_record$breakpoint_R) ~ "R",
|
||||
guideline_coerced %like% "CLSI" &
|
||||
isTRUE(which(levels(mic_input) == mic_input) >= which(levels(mic_R) == mic_R)) ~ "R",
|
||||
isTRUE(x[i] >= get_record$breakpoint_R) ~ "R",
|
||||
# return "I" when not match the bottom or top
|
||||
!is.na(get_record$breakpoint_S) & !is.na(get_record$breakpoint_R) ~ "I",
|
||||
# and NA otherwise
|
||||
|
Reference in New Issue
Block a user