From c3ae6b7699f56dfa4317471e9fa9e17f9a5f11e4 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Fri, 17 May 2019 09:09:18 +0200 Subject: [PATCH] freq fix --- .gitlab-ci.yml | 2 ++ DESCRIPTION | 2 +- R/freq.R | 10 ++++++---- docs/reference/ab_property.html | 2 ++ docs/reference/index.html | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2509f224..6904adc8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,6 +69,7 @@ R-release: - '*.Rcheck/*' expire_in: '1 month' cache: + when: always key: "r350" paths: - installed_deps/ @@ -99,6 +100,7 @@ R-devel: - '*.Rcheck/*' expire_in: '1 month' cache: + when: always key: "r360" paths: - installed_deps/ diff --git a/DESCRIPTION b/DESCRIPTION index a361e464..460550fc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: AMR Version: 0.6.1.9003 -Date: 2019-05-16 +Date: 2019-05-17 Title: Antimicrobial Resistance Analysis Authors@R: c( person( diff --git a/R/freq.R b/R/freq.R index c452d457..ad9b68a6 100755 --- a/R/freq.R +++ b/R/freq.R @@ -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) diff --git a/docs/reference/ab_property.html b/docs/reference/ab_property.html index 4e7d4bac..ce7146e6 100644 --- a/docs/reference/ab_property.html +++ b/docs/reference/ab_property.html @@ -259,6 +259,8 @@ ab_ddd(x, administration = "oral", units = FALSE, ...) +ab_info(x, language = get_locale(), ...) + ab_property(x, property = "name", language = get_locale(), ...)

Arguments

diff --git a/docs/reference/index.html b/docs/reference/index.html index 1f7dcfe6..458600b0 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -379,7 +379,7 @@ -

ab_name() ab_atc() ab_cid() ab_synonyms() ab_tradenames() ab_group() ab_atc_group1() ab_atc_group2() ab_ddd() ab_property()

+

ab_name() ab_atc() ab_cid() ab_synonyms() ab_tradenames() ab_group() ab_atc_group1() ab_atc_group2() ab_ddd() ab_info() ab_property()

Property of an antibiotic