mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 03:40:48 +01:00
(v3.0.1.9137) Add the guideline argument to count_df(), proportion_df(), sir_df(), ggplot_sir(), geom_sir(), and labels_sir_count(), so that with CLSI the 'I' category is merged with R, and describe in the documentation of get_AMR_locale() that LANG takes precedence over LANGUAGE
This commit is contained in:
1 parent
46f5de1d36
commit
dbd95ffa46
17 files changed
+118
-40
No files matched your search
+3
-2
@@ -44,7 +44,8 @@ count_df(
|
||||
data,
|
||||
translate_ab = "name",
|
||||
language = get_AMR_locale(),
|
||||
combine_SI = TRUE
|
||||
combine_SI = TRUE,
|
||||
guideline = getOption("AMR_guideline", "EUCAST")
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
@@ -66,7 +67,7 @@ You can also use e.g. \code{\link[=count_R]{count_R()}} or \code{\link[=count_S]
|
||||
|
||||
\item{language}{Language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the package option \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
|
||||
|
||||
\item{combine_SI}{A \link{logical} to indicate whether all values of S, SDD, and I must be merged into one, so the output only consists of S+SDD+I vs. R (susceptible vs. resistant) - the default is \code{TRUE}.}
|
||||
\item{combine_SI}{A \link{logical} to indicate whether the 'I' category must be merged with another category, so the output only consists of susceptible vs. resistant - the default is \code{TRUE}. Following the \code{guideline} argument, the output then consists of \code{"SI"} (S+SDD+I) vs. \code{"R"} with EUCAST, and of \code{"S"} (S+SDD) vs. \code{"IR"} (I+R) with CLSI.}
|
||||
}
|
||||
\value{
|
||||
An \link{integer}
|
||||
|
||||
+11
-1
@@ -17,6 +17,7 @@ ggplot_sir(
|
||||
combine_SI = TRUE,
|
||||
minimum = 30,
|
||||
language = get_AMR_locale(),
|
||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||
nrow = NULL,
|
||||
colours = c(S = "#3CAEA3", SDD = "#8FD6C4", SI = "#3CAEA3", I = "#F6D55C", IR =
|
||||
"#ED553B", R = "#ED553B"),
|
||||
@@ -39,6 +40,7 @@ geom_sir(
|
||||
minimum = 30,
|
||||
language = get_AMR_locale(),
|
||||
combine_SI = TRUE,
|
||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||
...
|
||||
)
|
||||
}
|
||||
@@ -59,12 +61,20 @@ geom_sir(
|
||||
|
||||
\item{translate_ab}{A column name of the \link{antimicrobials} data set to translate the antibiotic abbreviations to, using \code{\link[=ab_property]{ab_property()}}.}
|
||||
|
||||
\item{combine_SI}{A \link{logical} to indicate whether all values of S, SDD, and I must be merged into one, so the output only consists of S+SDD+I vs. R (susceptible vs. resistant) - the default is \code{TRUE}.}
|
||||
\item{combine_SI}{A \link{logical} to indicate whether the 'I' category must be merged with another category, so the output only consists of susceptible vs. resistant - the default is \code{TRUE}. Following the \code{guideline} argument, the output then consists of \code{"SI"} (S+SDD+I) vs. \code{"R"} with EUCAST, and of \code{"S"} (S+SDD) vs. \code{"IR"} (I+R) with CLSI.}
|
||||
|
||||
\item{minimum}{The minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see \emph{Source}.}
|
||||
|
||||
\item{language}{Language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the package option \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
|
||||
|
||||
\item{guideline}{Either \code{"EUCAST"} (default) or \code{"CLSI"}. With EUCAST, the 'I' category will be considered as susceptible (see \href{https://www.eucast.org/bacteria/clinical-breakpoints-and-interpretation/definition-of-s-i-and-r/}{EUCAST website}), but with with CLSI, it will be considered resistant. Therefore:
|
||||
\itemize{
|
||||
\item EUCAST: \code{\link[=susceptibility]{susceptibility()}} \eqn{= \%S + \%I}, \code{\link[=resistance]{resistance()}} \eqn{= \%R}
|
||||
\item CLSI: \code{\link[=susceptibility]{susceptibility()}} \eqn{= \%S + \%SDD}, \code{\link[=resistance]{resistance()}} \eqn{= \%I + \%R}
|
||||
}
|
||||
|
||||
You can also use e.g. \code{\link[=proportion_R]{proportion_R()}} or \code{\link[=proportion_S]{proportion_S()}} instead, to be explicit. For \code{\link[=proportion_df]{proportion_df()}}, \code{\link[=count_df]{count_df()}}, and \code{\link[=sir_df]{sir_df()}}, the guideline determines how 'I' is merged when \code{combine_SI = TRUE}.}
|
||||
|
||||
\item{nrow}{(when using \code{facet}) number of rows.}
|
||||
|
||||
\item{colours}{A named vactor with colour to be used for filling. The default colours are colour-blind friendly.}
|
||||
|
||||
+2
-1
@@ -159,6 +159,7 @@ labels_sir_count(
|
||||
minimum = 30,
|
||||
language = get_AMR_locale(),
|
||||
combine_SI = TRUE,
|
||||
guideline = getOption("AMR_guideline", "EUCAST"),
|
||||
datalabels.size = 3,
|
||||
datalabels.colour = "grey15"
|
||||
)
|
||||
@@ -210,7 +211,7 @@ labels_sir_count(
|
||||
|
||||
\item{minimum}{The minimum allowed number of available (tested) isolates. Any isolate count lower than \code{minimum} will return \code{NA} with a warning. The default number of \code{30} isolates is advised by the Clinical and Laboratory Standards Institute (CLSI) as best practice, see \emph{Source}.}
|
||||
|
||||
\item{combine_SI}{A \link{logical} to indicate whether all values of S, SDD, and I must be merged into one, so the output only consists of S+SDD+I vs. R (susceptible vs. resistant) - the default is \code{TRUE}.}
|
||||
\item{combine_SI}{A \link{logical} to indicate whether the 'I' category must be merged with another category, so the output only consists of susceptible vs. resistant - the default is \code{TRUE}. Following the \code{guideline} argument, the output then consists of \code{"SI"} (S+SDD+I) vs. \code{"R"} with EUCAST, and of \code{"S"} (S+SDD) vs. \code{"IR"} (I+R) with CLSI.}
|
||||
|
||||
\item{datalabels.size}{Size of the datalabels.}
|
||||
|
||||
|
||||
+6
-4
@@ -59,7 +59,8 @@ proportion_df(
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
combine_SI = TRUE,
|
||||
confidence_level = 0.95
|
||||
confidence_level = 0.95,
|
||||
guideline = getOption("AMR_guideline", "EUCAST")
|
||||
)
|
||||
|
||||
sir_df(
|
||||
@@ -69,7 +70,8 @@ sir_df(
|
||||
minimum = 30,
|
||||
as_percent = FALSE,
|
||||
combine_SI = TRUE,
|
||||
confidence_level = 0.95
|
||||
confidence_level = 0.95,
|
||||
guideline = getOption("AMR_guideline", "EUCAST")
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
@@ -87,7 +89,7 @@ sir_df(
|
||||
\item CLSI: \code{\link[=susceptibility]{susceptibility()}} \eqn{= \%S + \%SDD}, \code{\link[=resistance]{resistance()}} \eqn{= \%I + \%R}
|
||||
}
|
||||
|
||||
You can also use e.g. \code{\link[=proportion_R]{proportion_R()}} or \code{\link[=proportion_S]{proportion_S()}} instead, to be explicit.}
|
||||
You can also use e.g. \code{\link[=proportion_R]{proportion_R()}} or \code{\link[=proportion_S]{proportion_S()}} instead, to be explicit. For \code{\link[=proportion_df]{proportion_df()}}, \code{\link[=count_df]{count_df()}}, and \code{\link[=sir_df]{sir_df()}}, the guideline determines how 'I' is merged when \code{combine_SI = TRUE}.}
|
||||
|
||||
\item{ab_result}{Antibiotic results to test against, must be one or more values of "S", "SDD", "I", or "R".}
|
||||
|
||||
@@ -103,7 +105,7 @@ You can also use e.g. \code{\link[=proportion_R]{proportion_R()}} or \code{\link
|
||||
|
||||
\item{language}{Language of the returned text - the default is the current system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}) and can also be set with the package option \code{\link[=AMR-options]{AMR_locale}}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
|
||||
|
||||
\item{combine_SI}{A \link{logical} to indicate whether all values of S, SDD, and I must be merged into one, so the output only consists of S+SDD+I vs. R (susceptible vs. resistant) - the default is \code{TRUE}.}
|
||||
\item{combine_SI}{A \link{logical} to indicate whether the 'I' category must be merged with another category, so the output only consists of susceptible vs. resistant - the default is \code{TRUE}. Following the \code{guideline} argument, the output then consists of \code{"SI"} (S+SDD+I) vs. \code{"R"} with EUCAST, and of \code{"S"} (S+SDD) vs. \code{"IR"} (I+R) with CLSI.}
|
||||
}
|
||||
\value{
|
||||
A \link{double} or, when \code{as_percent = TRUE}, a \link{character}.
|
||||
|
||||
+6
-4
@@ -41,15 +41,17 @@ And then save the file.
|
||||
Please read about adding or updating a language in \href{https://github.com/msberends/AMR/wiki/}{our Wiki}.
|
||||
\subsection{Changing the Default Language}{
|
||||
|
||||
The system language will be used at default (as returned by \code{Sys.getenv("LANG")} or, if \code{LANG} is not set, \code{\link[=Sys.getlocale]{Sys.getlocale("LC_COLLATE")}}), if that language is supported. But the language to be used can be overwritten in two ways and will be checked in this order:
|
||||
The system language will be used at default, if that language is supported. The language to be used is determined in this order:
|
||||
\enumerate{
|
||||
\item Setting the package option \code{\link[=AMR-options]{AMR_locale}}, either by using e.g. \code{set_AMR_locale("German")} or by running e.g. \code{options(AMR_locale = "German")}.
|
||||
\item The package option \code{\link[=AMR-options]{AMR_locale}}, set by using e.g. \code{set_AMR_locale("German")} or by running e.g. \code{options(AMR_locale = "German")}.
|
||||
|
||||
Note that setting an \R option only works in the same session. Save the command \code{options(AMR_locale = "(your language)")} to your \code{.Rprofile} file to apply it for every session. Run \code{utils::file.edit("~/.Rprofile")} to edit your \code{.Rprofile} file.
|
||||
\item Setting the system variable \code{LANGUAGE} or \code{LANG}, e.g. by adding \code{LANGUAGE="de_DE.utf8"} to your \code{.Renviron} file in your home directory.
|
||||
\item The system variable \code{LANG}, as returned by \code{Sys.getenv("LANG")}, e.g. set by adding \code{LANG="de_DE.utf8"} to your \code{.Renviron} file in your home directory.
|
||||
\item The system variable \code{LANGUAGE}, but only if \code{LANG} is not set. Note that \code{LANG} is set on most Linux and macOS systems, in which case \code{LANGUAGE} has no effect.
|
||||
\item The system locale, as returned by \code{\link[=Sys.getlocale]{Sys.getlocale("LC_COLLATE")}}, if neither \code{LANG} nor \code{LANGUAGE} is set.
|
||||
}
|
||||
|
||||
Thus, if the package option \code{\link[=AMR-options]{AMR_locale}} is set, the system variables \code{LANGUAGE} and \code{LANG} will be ignored.
|
||||
Thus, if the package option \code{\link[=AMR-options]{AMR_locale}} is set, the system variables \code{LANG} and \code{LANGUAGE} will be ignored.
|
||||
}
|
||||
}
|
||||
\examples{
|
||||
|
||||
Reference in new issue
Block a user