From e89036098668ae7c2d205ca9d16fb19f116651b0 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Fri, 17 Feb 2023 11:39:00 +0100 Subject: [PATCH] website syntax update --- DESCRIPTION | 2 +- NEWS.md | 2 +- R/antibiogram.R | 13 +++++++++---- _pkgdown.yml | 4 ++++ man/antibiogram.Rd | 5 ++++- pkgdown/extra.css | 9 +++++---- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 49d7d84a..d30bf02d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.8.2.9132 +Version: 1.8.2.9133 Date: 2023-02-17 Title: Antimicrobial Resistance Data Analysis Description: Functions to simplify and standardise antimicrobial resistance (AMR) diff --git a/NEWS.md b/NEWS.md index 97956eb6..d181c2a2 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# AMR 1.8.2.9132 +# AMR 1.8.2.9133 *(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)* diff --git a/R/antibiogram.R b/R/antibiogram.R index a6816979..735a8d96 100755 --- a/R/antibiogram.R +++ b/R/antibiogram.R @@ -43,6 +43,7 @@ #' @param minimum the minimum allowed number of available (tested) isolates. Any isolate count lower than `minimum` will return `NA` with a warning. The default number of `30` isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see *Source*. #' @param combine_SI a [logical] to indicate whether all susceptibility should be determined by results of either S or I, instead of only S (defaults to `TRUE`) #' @param sep a separating character for antibiotic columns in combination antibiograms +#' @param info a [logical] to indicate info should be printed, defaults to `TRUE` only in interactive mode #' @param object an [antibiogram()] object #' @param ... when used in [print()]: arguments passed on to [knitr::kable()] (otherwise, has no use) #' @details This function returns a table with values between 0 and 100 for *susceptibility*, not resistance. @@ -253,7 +254,8 @@ antibiogram <- function(x, language = get_AMR_locale(), minimum = 30, combine_SI = TRUE, - sep = " + ") { + sep = " + ", + info = interactive()) { meet_criteria(x, allow_class = "data.frame", contains_column_class = "sir") meet_criteria(mo_transform, allow_class = "character", has_length = 1, is_in = c("name", "shortname", "gramstain", colnames(AMR::microorganisms)), allow_NULL = TRUE) meet_criteria(ab_transform, allow_class = "character", has_length = 1, is_in = colnames(AMR::antibiotics), allow_NULL = TRUE) @@ -266,7 +268,8 @@ antibiogram <- function(x, meet_criteria(minimum, allow_class = c("numeric", "integer"), has_length = 1, is_positive_or_zero = TRUE, is_finite = TRUE) meet_criteria(combine_SI, allow_class = "logical", has_length = 1) meet_criteria(sep, allow_class = "character", has_length = 1) - + meet_criteria(info, allow_class = "logical", has_length = 1) + # try to find columns based on type if (is.null(col_mo)) { col_mo <- search_type_in_df(x = x, type = "mo", info = interactive()) @@ -368,11 +371,13 @@ antibiogram <- function(x, out$numerator <- out$S } if (any(out$total < minimum, na.rm = TRUE)) { - message_("NOTE: ", sum(out$total < minimum, na.rm = TRUE), " combinations had less than `minimum = ", minimum, "` results and were ignored", add_fn = font_red) + if (isTRUE(info)) { + message_("NOTE: ", sum(out$total < minimum, na.rm = TRUE), " combinations had less than `minimum = ", minimum, "` results and were ignored", add_fn = font_red) + } out <- out %pm>% subset(total >= minimum) } - + # regroup for summarising if (isTRUE(has_syndromic_group)) { colnames(out)[1] <- "syndromic_group" diff --git a/_pkgdown.yml b/_pkgdown.yml index 1f5c83b1..d2e281ff 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -41,6 +41,10 @@ template: # the green "success" colour of this bootstrap theme should be the same as the green in our logo success: "#128f76" link-color: "#128f76" + light: "#128f76a6" # this is success with 60% alpha + # the template "info" is blue - this should be a green fitting our theme + info: "#60a799" + # make top bar a bit wider navbar-padding-y: "0.5rem" opengraph: twitter: diff --git a/man/antibiogram.Rd b/man/antibiogram.Rd index ced05dd7..4d46ef60 100644 --- a/man/antibiogram.Rd +++ b/man/antibiogram.Rd @@ -27,7 +27,8 @@ antibiogram( language = get_AMR_locale(), minimum = 30, combine_SI = TRUE, - sep = " + " + sep = " + ", + info = interactive() ) \method{plot}{antibiogram}(x, ...) @@ -63,6 +64,8 @@ antibiogram( \item{sep}{a separating character for antibiotic columns in combination antibiograms} +\item{info}{a \link{logical} to indicate info should be printed, defaults to \code{TRUE} only in interactive mode} + \item{...}{when used in \code{\link[=print]{print()}}: arguments passed on to \code{\link[knitr:kable]{knitr::kable()}} (otherwise, has no use)} \item{object}{an \code{\link[=antibiogram]{antibiogram()}} object} diff --git a/pkgdown/extra.css b/pkgdown/extra.css index 5628aeca..4275b98b 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -51,7 +51,7 @@ /* marked words for after using the search box */ mark, .mark { - background: rgba(17, 143, 118, 0.25) !important; + background: var(--bs-light) !important; } /* smaller tables */ @@ -82,17 +82,18 @@ pre .fu, .fu { } pre .st, .st { /* strings, regular text */ - color: #60a799 !important; + color: var(--bs-info) !important; } pre .co, .co { /* comments */ - color: #999999 !important; + color: var(--bs-success) !important; font-style: italic !important; } pre code .r-out, pre code .r-msg { /* output of functions */ - color: #555555 !important; + color: var(--bs-gray-600) !important; + font-style: normal !important; } code a[href], a[href] code,