1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-26 06:46:11 +01:00

add rows to summary

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-02-26 14:37:40 +01:00
parent 6fa05fe33b
commit 915d4db23b
No known key found for this signature in database
GPG Key ID: AE86720DBCDA4567

View File

@ -192,6 +192,7 @@ EUCAST_rules <- function(tbl,
} }
total <- 0 total <- 0
total_rows <- integer(0)
# functie voor uitvoeren # functie voor uitvoeren
edit_rsi <- function(to, rows, cols) { edit_rsi <- function(to, rows, cols) {
@ -200,6 +201,7 @@ EUCAST_rules <- function(tbl,
if (length(rows) > 0 & length(cols) > 0) { if (length(rows) > 0 & length(cols) > 0) {
tbl[rows, cols] <<- to tbl[rows, cols] <<- to
total <<- total + (length(rows) * length(cols)) total <<- total + (length(rows) * length(cols))
total_rows <<- c(total_rows, rows)
} }
} }
@ -222,9 +224,9 @@ EUCAST_rules <- function(tbl,
fluorochinolonen <- c(oflo, cipr, norf, levo, moxi) fluorochinolonen <- c(oflo, cipr, norf, levo, moxi)
if (info == TRUE) { if (info == TRUE) {
cat('\nApplying EUCAST expert rules on', cat('\nApplying rules to',
tbl[!is.na(tbl$genus),] %>% nrow(), tbl[!is.na(tbl$genus),] %>% nrow() %>% format(big.mark = ","),
'isolates according to "EUCAST Expert Rules Version 3.1"\n\n') 'rows according to "EUCAST Expert Rules Version 3.1"\n\n')
} }
# Table 1: Intrinsic resistance in Enterobacteriaceae ---- # Table 1: Intrinsic resistance in Enterobacteriaceae ----
@ -603,7 +605,10 @@ EUCAST_rules <- function(tbl,
colnames(tbl) <- gsub("_tempbactlist", "", colnames(tbl)) colnames(tbl) <- gsub("_tempbactlist", "", colnames(tbl))
if (info == TRUE) { if (info == TRUE) {
cat('\nDone.\nExpert rules applied to', total, 'test results.\n') cat('\nDone.\nEUCAST Expert rules applied to',
total_rows %>% unique() %>% length() %>% format(big.mark = ","),
'different rows, to a total of',
total %>% format(big.mark = ","), 'test results.\n\n')
} }
tbl tbl