1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 04:02:19 +02:00
This commit is contained in:
2019-05-17 09:09:18 +02:00
parent 5eda991c47
commit c3ae6b7699
5 changed files with 12 additions and 6 deletions

View File

@ -585,10 +585,12 @@ format_header <- function(x, markdown = FALSE, decimal.mark = ".", big.mark = ",
# FORMATTING
# rsi
if (has_length == TRUE & any(x_class == "rsi")) {
ab <- tryCatch(as.ab(attributes(x)$opt$vars), error = function(e) NA)
if (!is.na(ab) & isTRUE(length(ab) > 0)) {
header$drug <- paste0(ab_name(ab[1L]), " (", ab[1L], ", ", ab_atc(ab[1L]), ")")
header$group <- ab_group(ab[1L])
if (!is.null(attributes(x)$opt$vars)) {
ab <- tryCatch(as.ab(attributes(x)$opt$vars), error = function(e) NA)
if (!is.na(ab) & isTRUE(length(ab) > 0)) {
header$drug <- paste0(ab_name(ab[1L]), " (", ab[1L], ", ", ab_atc(ab[1L]), ")")
header$group <- ab_group(ab[1L])
}
}
header$`%SI` <- percent(header$count_SI / (header$count_SI + header$count_R),
force_zero = TRUE, round = digits, decimal.mark = decimal.mark)