1
0
mirror of https://github.com/msberends/AMR.git synced 2026-06-24 10:56:23 +02:00

(v3.0.1.9059) Fix WISCA in vignette

This commit is contained in:
2026-06-23 14:38:59 +02:00
parent 3f9f931777
commit 9898b5df4b
41 changed files with 1310 additions and 757 deletions

View File

@@ -4,9 +4,15 @@
\alias{ab_from_text}
\title{Retrieve Antimicrobial Drug Names and Doses from Clinical Text}
\usage{
ab_from_text(text, type = c("drug", "dose", "administration"),
collapse = NULL, translate_ab = FALSE, thorough_search = NULL,
info = interactive(), ...)
ab_from_text(
text,
type = c("drug", "dose", "administration"),
collapse = NULL,
translate_ab = FALSE,
thorough_search = NULL,
info = interactive(),
...
)
}
\arguments{
\item{text}{Text to analyse.}

View File

@@ -47,8 +47,13 @@ ab_url(x, open = FALSE, ...)
ab_property(x, property = "name", language = get_AMR_locale(), ...)
set_ab_names(data, ..., property = "name", language = get_AMR_locale(),
snake_case = NULL)
set_ab_names(
data,
...,
property = "name",
language = get_AMR_locale(),
snake_case = NULL
)
}
\arguments{
\item{x}{Any (vector of) text that can be coerced to a valid antibiotic drug code with \code{\link[=as.ab]{as.ab()}}.}

View File

@@ -4,8 +4,7 @@
\alias{age_groups}
\title{Split Ages into Age Groups}
\usage{
age_groups(x, split_at = c(0, 12, 25, 55, 75), names = NULL,
na.rm = FALSE)
age_groups(x, split_at = c(0, 12, 25, 55, 75), names = NULL, na.rm = FALSE)
}
\arguments{
\item{x}{Age, e.g. calculated with \code{\link[=age]{age()}}.}

View File

@@ -24,11 +24,25 @@ all_disk()
all_disk_predictors()
step_mic_log2(recipe, ..., role = NA, trained = FALSE, columns = NULL,
skip = FALSE, id = recipes::rand_id("mic_log2"))
step_mic_log2(
recipe,
...,
role = NA,
trained = FALSE,
columns = NULL,
skip = FALSE,
id = recipes::rand_id("mic_log2")
)
step_sir_numeric(recipe, ..., role = NA, trained = FALSE, columns = NULL,
skip = FALSE, id = recipes::rand_id("sir_numeric"))
step_sir_numeric(
recipe,
...,
role = NA,
trained = FALSE,
columns = NULL,
skip = FALSE,
id = recipes::rand_id("sir_numeric")
)
}
\arguments{
\item{recipe}{A recipe object. The step will be added to the sequence of

View File

@@ -10,37 +10,78 @@
\alias{knit_print.antibiogram}
\title{Generate Traditional, Combination, Syndromic, or WISCA Antibiograms}
\usage{
antibiogram(x, antimicrobials = where(is.sir), mo_transform = "shortname",
ab_transform = "name", syndromic_group = NULL, add_total_n = FALSE,
only_all_tested = FALSE, digits = ifelse(wisca, 1, 0),
formatting_type = getOption("AMR_antibiogram_formatting_type",
ifelse(wisca, 14, 18)), col_mo = NULL, language = get_AMR_locale(),
minimum = 30, combine_SI = TRUE, sep = " + ", sort_columns = TRUE,
wisca = FALSE, simulations = 1000, conf_interval = 0.95,
interval_side = "two-tailed", info = interactive(), parallel = FALSE,
...)
wisca(x, antimicrobials = where(is.sir), ab_transform = "name",
syndromic_group = NULL, only_all_tested = FALSE, digits = 1,
wisca(
x,
antimicrobials = where(is.sir),
ab_transform = "name",
syndromic_group = NULL,
only_all_tested = FALSE,
digits = 1,
formatting_type = getOption("AMR_antibiogram_formatting_type", 14),
col_mo = NULL, language = get_AMR_locale(), combine_SI = TRUE,
sep = " + ", sort_columns = TRUE, simulations = 1000,
conf_interval = 0.95, interval_side = "two-tailed",
info = interactive(), parallel = FALSE, ...)
col_mo = NULL,
language = get_AMR_locale(),
combine_SI = TRUE,
sep = " + ",
sort_columns = TRUE,
simulations = 1000,
conf_interval = 0.95,
interval_side = "two-tailed",
info = interactive(),
parallel = FALSE,
...
)
antibiogram(
x,
antimicrobials = where(is.sir),
mo_transform = "shortname",
ab_transform = "name",
syndromic_group = NULL,
add_total_n = FALSE,
only_all_tested = FALSE,
digits = ifelse(wisca, 1, 0),
formatting_type = getOption("AMR_antibiogram_formatting_type", ifelse(wisca, 14, 18)),
col_mo = NULL,
language = get_AMR_locale(),
minimum = 30,
combine_SI = TRUE,
sep = " + ",
sort_columns = TRUE,
wisca = FALSE,
simulations = 1000,
conf_interval = 0.95,
interval_side = "two-tailed",
info = interactive(),
parallel = FALSE,
...
)
retrieve_wisca_parameters(wisca_model, ...)
\method{plot}{antibiogram}(x, ...)
\method{autoplot}{antibiogram}(object, geom = c("pointrange", "point", "col",
"bar", "errorbar"), ci = TRUE, sort = TRUE, flip = NULL,
caption = NULL, ...)
\method{autoplot}{antibiogram}(
object,
geom = c("pointrange", "point", "col", "bar", "errorbar"),
ci = TRUE,
sort = TRUE,
flip = NULL,
caption = NULL,
...
)
wisca_plot(wisca_model, wisca_plot_type = c("susceptibility_incidence",
"posterior_coverage"), ...)
wisca_plot(
wisca_model,
wisca_plot_type = c("susceptibility_incidence", "posterior_coverage"),
...
)
\method{knit_print}{antibiogram}(x, italicise = TRUE,
na = getOption("knitr.kable.NA", default = ""), ...)
\method{knit_print}{antibiogram}(
x,
italicise = TRUE,
na = getOption("knitr.kable.NA", default = ""),
...
)
}
\arguments{
\item{x}{A \link{data.frame} containing at least a column with microorganisms and columns with antimicrobial results (class 'sir', see \code{\link[=as.sir]{as.sir()}}).}
@@ -66,14 +107,10 @@ wisca_plot(wisca_model, wisca_plot_type = c("susceptibility_incidence",
}
}}
\item{mo_transform}{A character to transform microorganism input - must be \code{"name"}, \code{"shortname"} (default), \code{"gramstain"}, or one of the column names of the \link{microorganisms} data set: \code{"mo"}, \code{"fullname"}, \code{"status"}, \code{"domain"}, \code{"kingdom"}, \code{"phylum"}, \code{"class"}, \code{"order"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"subspecies"}, \code{"rank"}, \code{"ref"}, \code{"oxygen_tolerance"}, \code{"morphology"}, \code{"source"}, \code{"lpsn"}, \code{"lpsn_parent"}, \code{"lpsn_renamed_to"}, \code{"mycobank"}, \code{"mycobank_parent"}, \code{"mycobank_renamed_to"}, \code{"gbif"}, \code{"gbif_parent"}, \code{"gbif_renamed_to"}, \code{"prevalence"}, or \code{"snomed"}. Can also be \code{NULL} to not transform the input or \code{NA} to consider all microorganisms 'unknown'.}
\item{ab_transform}{A character to transform antimicrobial input - must be one of the column names of the \link{antimicrobials} data set (defaults to \code{"name"}): \code{"ab"}, \code{"cid"}, \code{"name"}, \code{"group"}, \code{"atc"}, \code{"atc_group1"}, \code{"atc_group2"}, \code{"abbreviations"}, \code{"synonyms"}, \code{"oral_ddd"}, \code{"oral_units"}, \code{"iv_ddd"}, \code{"iv_units"}, or \code{"loinc"}. Can also be \code{NULL} to not transform the input.}
\item{syndromic_group}{A column name of \code{x}, or values calculated to split rows of \code{x}, e.g. by using \code{\link[=ifelse]{ifelse()}} or \code{\link[dplyr:case-and-replace-when]{case_when()}}. See \emph{Examples}.}
\item{add_total_n}{\emph{(deprecated in favour of \code{formatting_type})} A \link{logical} to indicate whether \code{n_tested} available numbers per pathogen should be added to the table (default is \code{TRUE}). This will add the lowest and highest number of available isolates per antimicrobial (e.g, if for \emph{E. coli} 200 isolates are available for ciprofloxacin and 150 for amoxicillin, the returned number will be "150-200"). This option is unavailable when \code{wisca = TRUE}; in that case, use \code{\link[=retrieve_wisca_parameters]{retrieve_wisca_parameters()}} to get the parameters used for WISCA.}
\item{only_all_tested}{(for combination antibiograms): a \link{logical} to indicate that isolates must be tested for all antimicrobials, see \emph{Details}.}
\item{digits}{Number of digits to use for rounding the antimicrobial coverage, defaults to 1 for WISCA and 0 otherwise.}
@@ -84,18 +121,12 @@ wisca_plot(wisca_model, wisca_plot_type = c("susceptibility_incidence",
\item{language}{Language to translate text, which defaults to the system language (see \code{\link[=get_AMR_locale]{get_AMR_locale()}}).}
\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 susceptibility should be determined by results of either S, SDD, or I, instead of only S (default is \code{TRUE}).}
\item{sep}{A separating character for antimicrobial columns in combination antibiograms.}
\item{sort_columns}{A \link{logical} to indicate whether the antimicrobial columns must be sorted on name.}
\item{wisca}{A \link{logical} to indicate whether a Weighted-Incidence Syndromic Combination Antibiogram (WISCA) must be generated (default is \code{FALSE}). This will use a Bayesian decision model to estimate regimen coverage probabilities using \href{https://en.wikipedia.org/wiki/Monte_Carlo_method}{Monte Carlo simulations}. Per \doi{10.1093/jac/dkv397}, susceptibility priors are \eqn{\beta(0.5, 0.5)} (Jeffreys) and intrinsically resistant pairs (based on \link{intrinsic_resistant}) use \eqn{\beta(1, 9999)}.
Set \code{simulations}, \code{conf_interval}, and \code{interval_side} to adjust.}
\item{simulations}{(for WISCA) a numerical value to set the number of Monte Carlo simulations.}
\item{conf_interval}{A numerical value to set confidence interval (default is \code{0.95}).}
@@ -108,6 +139,16 @@ Set \code{simulations}, \code{conf_interval}, and \code{interval_side} to adjust
\item{...}{Currently unused.}
\item{mo_transform}{A character to transform microorganism input - must be \code{"name"}, \code{"shortname"} (default), \code{"gramstain"}, or one of the column names of the \link{microorganisms} data set: \code{"mo"}, \code{"fullname"}, \code{"status"}, \code{"domain"}, \code{"kingdom"}, \code{"phylum"}, \code{"class"}, \code{"order"}, \code{"family"}, \code{"genus"}, \code{"species"}, \code{"subspecies"}, \code{"rank"}, \code{"ref"}, \code{"oxygen_tolerance"}, \code{"morphology"}, \code{"source"}, \code{"lpsn"}, \code{"lpsn_parent"}, \code{"lpsn_renamed_to"}, \code{"mycobank"}, \code{"mycobank_parent"}, \code{"mycobank_renamed_to"}, \code{"gbif"}, \code{"gbif_parent"}, \code{"gbif_renamed_to"}, \code{"prevalence"}, or \code{"snomed"}. Can also be \code{NULL} to not transform the input or \code{NA} to consider all microorganisms 'unknown'.}
\item{add_total_n}{\emph{(deprecated in favour of \code{formatting_type})} A \link{logical} to indicate whether \code{n_tested} available numbers per pathogen should be added to the table (default is \code{TRUE}). This will add the lowest and highest number of available isolates per antimicrobial (e.g, if for \emph{E. coli} 200 isolates are available for ciprofloxacin and 150 for amoxicillin, the returned number will be "150-200"). This option is unavailable when \code{wisca = TRUE}; in that case, use \code{\link[=retrieve_wisca_parameters]{retrieve_wisca_parameters()}} to get the parameters used for WISCA.}
\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{wisca}{A \link{logical} to indicate whether a Weighted-Incidence Syndromic Combination Antibiogram (WISCA) must be generated (default is \code{FALSE}). This will use a Bayesian decision model to estimate regimen coverage probabilities using \href{https://en.wikipedia.org/wiki/Monte_Carlo_method}{Monte Carlo simulations}. Per \doi{10.1093/jac/dkv397}, susceptibility priors are \eqn{\beta(0.5, 0.5)} (Jeffreys) and intrinsically resistant pairs (based on \link{intrinsic_resistant}) use \eqn{\beta(1, 9999)}.
Set \code{simulations}, \code{conf_interval}, and \code{interval_side} to adjust.}
\item{wisca_model}{The outcome of \code{\link[=wisca]{wisca()}} or \code{\link[=antibiogram]{antibiogram(..., wisca = TRUE)}}.}
\item{object}{An \code{\link[=antibiogram]{antibiogram()}} object.}

View File

@@ -45,8 +45,12 @@
\alias{not_intrinsic_resistant}
\title{Antimicrobial Selectors}
\usage{
aminoglycosides(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
aminoglycosides(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
aminopenicillins(only_sir_columns = FALSE, return_all = TRUE, ...)
@@ -54,41 +58,68 @@ antifungals(only_sir_columns = FALSE, return_all = TRUE, ...)
antimycobacterials(only_sir_columns = FALSE, return_all = TRUE, ...)
betalactams(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
betalactams(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
betalactams_with_inhibitor(only_sir_columns = FALSE, return_all = TRUE,
...)
betalactams_with_inhibitor(only_sir_columns = FALSE, return_all = TRUE, ...)
carbapenems(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
carbapenems(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
cephalosporins(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
cephalosporins(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
cephalosporins_1st(only_sir_columns = FALSE, return_all = TRUE, ...)
cephalosporins_2nd(only_sir_columns = FALSE, return_all = TRUE, ...)
cephalosporins_3rd(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
cephalosporins_3rd(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
cephalosporins_4th(only_sir_columns = FALSE, return_all = TRUE, ...)
cephalosporins_5th(only_sir_columns = FALSE, return_all = TRUE, ...)
fluoroquinolones(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
fluoroquinolones(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
glycopeptides(only_sir_columns = FALSE, return_all = TRUE, ...)
ionophores(only_sir_columns = FALSE, return_all = TRUE, ...)
isoxazolylpenicillins(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
isoxazolylpenicillins(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
lincosamides(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
lincosamides(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
lipoglycopeptides(only_sir_columns = FALSE, return_all = TRUE, ...)
@@ -108,11 +139,19 @@ phenicols(only_sir_columns = FALSE, return_all = TRUE, ...)
phosphonics(only_sir_columns = FALSE, return_all = TRUE, ...)
polymyxins(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
polymyxins(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
quinolones(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
quinolones(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
rifamycins(only_sir_columns = FALSE, return_all = TRUE, ...)
@@ -122,25 +161,43 @@ streptogramins(only_sir_columns = FALSE, return_all = TRUE, ...)
sulfonamides(only_sir_columns = FALSE, return_all = TRUE, ...)
tetracyclines(only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
tetracyclines(
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
trimethoprims(only_sir_columns = FALSE, return_all = TRUE, ...)
ureidopenicillins(only_sir_columns = FALSE, return_all = TRUE, ...)
amr_class(amr_class, only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
amr_class(
amr_class,
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
amr_selector(filter, only_sir_columns = FALSE, only_treatable = TRUE,
return_all = TRUE, ...)
amr_selector(
filter,
only_sir_columns = FALSE,
only_treatable = TRUE,
return_all = TRUE,
...
)
administrable_per_os(only_sir_columns = FALSE, return_all = TRUE, ...)
administrable_iv(only_sir_columns = FALSE, return_all = TRUE, ...)
not_intrinsic_resistant(only_sir_columns = FALSE, col_mo = NULL,
version_expected_phenotypes = 1.2, ...)
not_intrinsic_resistant(
only_sir_columns = FALSE,
col_mo = NULL,
version_expected_phenotypes = 1.2,
...
)
}
\arguments{
\item{only_sir_columns}{A \link{logical} to indicate whether only antimicrobial columns must be included that were transformed to class \link[=as.sir]{sir} on beforehand. Defaults to \code{FALSE}.}

View File

@@ -9,8 +9,13 @@
\alias{NA_ab_}
\title{Transform Input to an Antibiotic ID}
\usage{
as.ab(x, flag_multiple_results = TRUE, language = get_AMR_locale(),
info = interactive(), ...)
as.ab(
x,
flag_multiple_results = TRUE,
language = get_AMR_locale(),
info = interactive(),
...
)
is.ab(x)

View File

@@ -12,15 +12,19 @@
\alias{droplevels.mic}
\title{Transform Input to Minimum Inhibitory Concentrations (MIC)}
\usage{
as.mic(x, na.rm = FALSE, keep_operators = "all",
round_to_next_log2 = FALSE)
as.mic(x, na.rm = FALSE, keep_operators = "all", round_to_next_log2 = FALSE)
is.mic(x)
NA_mic_
rescale_mic(x, mic_range, keep_operators = "edges", as.mic = TRUE,
round_to_next_log2 = FALSE)
rescale_mic(
x,
mic_range,
keep_operators = "edges",
as.mic = TRUE,
round_to_next_log2 = FALSE
)
mic_p50(x, na.rm = FALSE, ...)

View File

@@ -13,14 +13,20 @@
\alias{NA_mo_}
\title{Transform Arbitrary Input to Valid Microbial Taxonomy}
\usage{
as.mo(x, Becker = FALSE, Lancefield = FALSE,
as.mo(
x,
Becker = FALSE,
Lancefield = FALSE,
minimum_matching_score = NULL,
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
reference_df = get_mo_source(),
ignore_pattern = getOption("AMR_ignore_pattern", NULL),
cleaning_regex = getOption("AMR_cleaning_regex", mo_cleaning_regex()),
only_fungi = getOption("AMR_only_fungi", FALSE),
language = get_AMR_locale(), info = interactive(), ...)
language = get_AMR_locale(),
info = interactive(),
...
)
is.mo(x)

View File

@@ -22,48 +22,86 @@ is.sir(x)
is_sir_eligible(x, threshold = 0.05)
\method{as.sir}{default}(x, S = "^(S|U|1)+$", I = "^(I|2)+$",
R = "^(R|3)+$", NI = "^(N|NI|V|4)+$", SDD = "^(SDD|D|H|5)+$",
WT = "^(WT|6)+$", NWT = "^(NWT|7)+$", NS = "^(NS|8)+$",
info = interactive(), ...)
\method{as.sir}{default}(
x,
S = "^(S|U|1)+$",
I = "^(I|2)+$",
R = "^(R|3)+$",
NI = "^(N|NI|V|4)+$",
SDD = "^(SDD|D|H|5)+$",
WT = "^(WT|6)+$",
NWT = "^(NWT|7)+$",
NS = "^(NS|8)+$",
info = interactive(),
...
)
\method{as.sir}{mic}(x, mo = NULL, ab = deparse(substitute(x)),
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
\method{as.sir}{mic}(
x,
mo = NULL,
ab = deparse(substitute(x)),
guideline = getOption("AMR_guideline", "EUCAST"),
uti = NULL,
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
as_wt_nwt = identical(breakpoint_type, "ECOFF"),
add_intrinsic_resistance = FALSE,
reference_data = AMR::clinical_breakpoints,
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
FALSE),
include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
language = get_AMR_locale(), verbose = FALSE, info = interactive(),
conserve_capped_values = NULL, ...)
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
host = NULL,
language = get_AMR_locale(),
verbose = FALSE,
info = interactive(),
conserve_capped_values = NULL,
...
)
\method{as.sir}{disk}(x, mo = NULL, ab = deparse(substitute(x)),
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
\method{as.sir}{disk}(
x,
mo = NULL,
ab = deparse(substitute(x)),
guideline = getOption("AMR_guideline", "EUCAST"),
uti = NULL,
as_wt_nwt = identical(breakpoint_type, "ECOFF"),
add_intrinsic_resistance = FALSE,
reference_data = AMR::clinical_breakpoints,
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
FALSE),
include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
language = get_AMR_locale(), verbose = FALSE, info = interactive(),
...)
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
host = NULL,
language = get_AMR_locale(),
verbose = FALSE,
info = interactive(),
...
)
\method{as.sir}{data.frame}(x, ..., col_mo = NULL,
guideline = getOption("AMR_guideline", "EUCAST"), uti = NULL,
\method{as.sir}{data.frame}(
x,
...,
col_mo = NULL,
guideline = getOption("AMR_guideline", "EUCAST"),
uti = NULL,
capped_mic_handling = getOption("AMR_capped_mic_handling", "standard"),
as_wt_nwt = identical(breakpoint_type, "ECOFF"),
add_intrinsic_resistance = FALSE,
reference_data = AMR::clinical_breakpoints,
substitute_missing_r_breakpoint = getOption("AMR_substitute_missing_r_breakpoint",
FALSE), include_screening = getOption("AMR_include_screening", FALSE),
FALSE),
include_screening = getOption("AMR_include_screening", FALSE),
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), host = NULL,
language = get_AMR_locale(), verbose = FALSE, info = interactive(),
parallel = FALSE, conserve_capped_values = NULL)
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
host = NULL,
language = get_AMR_locale(),
verbose = FALSE,
info = interactive(),
parallel = FALSE,
conserve_capped_values = NULL
)
sir_interpretation_history(clean = FALSE)
}

View File

@@ -10,9 +10,13 @@
\url{https://atcddd.fhi.no/atc_ddd_alterations__cumulative/ddd_alterations/abbrevations/}
}
\usage{
atc_online_property(atc_code, property, administration = "O",
atc_online_property(
atc_code,
property,
administration = "O",
url = "https://atcddd.fhi.no/atc_ddd_index/?code=\%s&showdescription=no",
url_vet = "https://atcddd.fhi.no/atcvet/atcvet_index/?code=\%s&showdescription=no")
url_vet = "https://atcddd.fhi.no/atcvet/atcvet_index/?code=\%s&showdescription=no"
)
atc_online_groups(atc_code, ...)

View File

@@ -4,9 +4,15 @@
\alias{av_from_text}
\title{Retrieve Antiviral Drug Names and Doses from Clinical Text}
\usage{
av_from_text(text, type = c("drug", "dose", "administration"),
collapse = NULL, translate_av = FALSE, thorough_search = NULL,
info = interactive(), ...)
av_from_text(
text,
type = c("drug", "dose", "administration"),
collapse = NULL,
translate_av = FALSE,
thorough_search = NULL,
info = interactive(),
...
)
}
\arguments{
\item{text}{Text to analyse.}

View File

@@ -5,14 +5,26 @@
\alias{format.bug_drug_combinations}
\title{Determine Bug-Drug Combinations}
\usage{
bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname,
include_n_rows = FALSE, ...)
bug_drug_combinations(
x,
col_mo = NULL,
FUN = mo_shortname,
include_n_rows = FALSE,
...
)
\method{format}{bug_drug_combinations}(x, translate_ab = "name (ab, atc)",
language = get_AMR_locale(), minimum = 30, combine_SI = TRUE,
add_ab_group = TRUE, remove_intrinsic_resistant = FALSE,
decimal.mark = getOption("OutDec"), big.mark = ifelse(decimal.mark ==
",", ".", ","), ...)
\method{format}{bug_drug_combinations}(
x,
translate_ab = "name (ab, atc)",
language = get_AMR_locale(),
minimum = 30,
combine_SI = TRUE,
add_ab_group = TRUE,
remove_intrinsic_resistant = FALSE,
decimal.mark = getOption("OutDec"),
big.mark = ifelse(decimal.mark == ",", ".", ","),
...
)
}
\arguments{
\item{x}{A data set with antimicrobials columns, such as \code{amox}, \code{AMX} and \code{AMC}.}

View File

@@ -14,11 +14,17 @@
\alias{count_df}
\title{Count Available Isolates}
\usage{
count_resistant(..., only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST"))
count_resistant(
...,
only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST")
)
count_susceptible(..., only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST"))
count_susceptible(
...,
only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST")
)
count_S(..., only_all_tested = FALSE)
@@ -34,8 +40,12 @@ count_all(..., only_all_tested = FALSE)
n_sir(..., only_all_tested = FALSE)
count_df(data, translate_ab = "name", language = get_AMR_locale(),
combine_SI = TRUE)
count_df(
data,
translate_ab = "name",
language = get_AMR_locale(),
combine_SI = TRUE
)
}
\arguments{
\item{...}{One or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with \code{\link[=as.sir]{as.sir()}} if needed.}

View File

@@ -4,9 +4,13 @@
\alias{export_ncbi_biosample}
\title{Export Data Set as NCBI BioSample Antibiogram}
\usage{
export_ncbi_biosample(x, filename = paste0("biosample_", format(Sys.time(),
"\%Y-\%m-\%d-\%H\%M\%S"), ".xlsx"), type = "pathogen MIC",
columns = where(is.mic), save_as_xlsx = TRUE)
export_ncbi_biosample(
x,
filename = paste0("biosample_", format(Sys.time(), "\%Y-\%m-\%d-\%H\%M\%S"), ".xlsx"),
type = "pathogen MIC",
columns = where(is.mic),
save_as_xlsx = TRUE
)
}
\arguments{
\item{x}{A data set.}

View File

@@ -5,18 +5,38 @@
\alias{filter_first_isolate}
\title{Determine First Isolates}
\usage{
first_isolate(x = NULL, col_date = NULL, col_patient_id = NULL,
col_mo = NULL, col_testcode = NULL, col_specimen = NULL,
col_icu = NULL, col_keyantimicrobials = NULL, episode_days = 365,
testcodes_exclude = NULL, icu_exclude = FALSE, specimen_group = NULL,
type = "points", method = c("phenotype-based", "episode-based",
"patient-based", "isolate-based"), ignore_I = TRUE, points_threshold = 2,
info = interactive(), include_unknown = FALSE,
include_untested_sir = TRUE, ...)
first_isolate(
x = NULL,
col_date = NULL,
col_patient_id = NULL,
col_mo = NULL,
col_testcode = NULL,
col_specimen = NULL,
col_icu = NULL,
col_keyantimicrobials = NULL,
episode_days = 365,
testcodes_exclude = NULL,
icu_exclude = FALSE,
specimen_group = NULL,
type = "points",
method = c("phenotype-based", "episode-based", "patient-based", "isolate-based"),
ignore_I = TRUE,
points_threshold = 2,
info = interactive(),
include_unknown = FALSE,
include_untested_sir = TRUE,
...
)
filter_first_isolate(x = NULL, col_date = NULL, col_patient_id = NULL,
col_mo = NULL, episode_days = 365, method = c("phenotype-based",
"episode-based", "patient-based", "isolate-based"), ...)
filter_first_isolate(
x = NULL,
col_date = NULL,
col_patient_id = NULL,
col_mo = NULL,
episode_days = 365,
method = c("phenotype-based", "episode-based", "patient-based", "isolate-based"),
...
)
}
\arguments{
\item{x}{A \link{data.frame} containing isolates. Can be left blank for automatic determination, see \emph{Examples}.}

View File

@@ -46,7 +46,7 @@ A list with class \code{"htest"} containing the following
\code{(observed - expected) / sqrt(expected)}.}
\item{stdres}{standardized residuals,
\code{(observed - expected) / sqrt(V)}, where \code{V} is the
residual cell variance {(\if{html}{\out{<a href="#reference+chisq.test.Rd+R+3AAgresti+3A2007" class="citation">}}Agresti 2007\if{html}{\out{</a>}}, section 2.4.5)}
residual cell variance (Agresti, 2007, section 2.4.5
for the case where \code{x} is a matrix, \code{n * p * (1 - p)} otherwise).}
}
\description{

View File

@@ -17,13 +17,30 @@ As per their GPL-2 licence that demands documentation of code changes, the chang
}
}
\usage{
ggplot_pca(x, choices = 1:2, scale = 1, pc.biplot = TRUE,
labels = NULL, labels_textsize = 3, labels_text_placement = 1.5,
groups = NULL, ellipse = TRUE, ellipse_prob = 0.68,
ellipse_size = 0.5, ellipse_alpha = 0.5, points_size = 2,
points_alpha = 0.25, arrows = TRUE, arrows_colour = "darkblue",
arrows_size = 0.5, arrows_textsize = 3, arrows_textangled = TRUE,
arrows_alpha = 0.75, base_textsize = 10, ...)
ggplot_pca(
x,
choices = 1:2,
scale = 1,
pc.biplot = TRUE,
labels = NULL,
labels_textsize = 3,
labels_text_placement = 1.5,
groups = NULL,
ellipse = TRUE,
ellipse_prob = 0.68,
ellipse_size = 0.5,
ellipse_alpha = 0.5,
points_size = 2,
points_alpha = 0.25,
arrows = TRUE,
arrows_colour = "darkblue",
arrows_size = 0.5,
arrows_textsize = 3,
arrows_textangled = TRUE,
arrows_alpha = 0.75,
base_textsize = 10,
...
)
}
\arguments{
\item{x}{An object returned by \code{\link[=pca]{pca()}}, \code{\link[=prcomp]{prcomp()}} or \code{\link[=princomp]{princomp()}}.}
@@ -42,9 +59,8 @@ ggplot_pca(x, choices = 1:2, scale = 1, pc.biplot = TRUE,
}
\item{pc.biplot}{
If true, use what {\if{html}{\cite{}\out{<a href="#reference+biplot.princomp.Rd+R+3AGabriel+3A1971" class="citation">}}Gabriel (1971)\if{html}{\out{</a>}}} refers to as a
\dQuote{principal component biplot},
with \code{lambda = 1} and observations scaled up by sqrt(n) and
If true, use what Gabriel (1971) refers to as a "principal component
biplot", with \code{lambda = 1} and observations scaled up by sqrt(n) and
variables scaled down by sqrt(n). Then inner products between
variables approximate covariances and distances between observations
approximate Mahalanobis distance.

View File

@@ -5,18 +5,42 @@
\alias{geom_sir}
\title{AMR Plots with \code{ggplot2}}
\usage{
ggplot_sir(data, position = NULL, x = "antibiotic",
fill = "interpretation", facet = NULL, breaks = seq(0, 1, 0.1),
limits = NULL, translate_ab = "name", combine_SI = TRUE,
minimum = 30, language = get_AMR_locale(), nrow = NULL, colours = c(S
= "#3CAEA3", SDD = "#8FD6C4", SI = "#3CAEA3", I = "#F6D55C", IR = "#ED553B",
R = "#ED553B"), datalabels = TRUE, datalabels.size = 2.5,
datalabels.colour = "grey15", title = NULL, subtitle = NULL,
caption = NULL, x.title = "Antimicrobial", y.title = "Proportion", ...)
ggplot_sir(
data,
position = NULL,
x = "antibiotic",
fill = "interpretation",
facet = NULL,
breaks = seq(0, 1, 0.1),
limits = NULL,
translate_ab = "name",
combine_SI = TRUE,
minimum = 30,
language = get_AMR_locale(),
nrow = NULL,
colours = c(S = "#3CAEA3", SDD = "#8FD6C4", SI = "#3CAEA3", I = "#F6D55C", IR =
"#ED553B", R = "#ED553B"),
datalabels = TRUE,
datalabels.size = 2.5,
datalabels.colour = "grey15",
title = NULL,
subtitle = NULL,
caption = NULL,
x.title = "Antimicrobial",
y.title = "Proportion",
...
)
geom_sir(position = NULL, x = c("antibiotic", "interpretation"),
fill = "interpretation", translate_ab = "name", minimum = 30,
language = get_AMR_locale(), combine_SI = TRUE, ...)
geom_sir(
position = NULL,
x = c("antibiotic", "interpretation"),
fill = "interpretation",
translate_ab = "name",
minimum = 30,
language = get_AMR_locale(),
combine_SI = TRUE,
...
)
}
\arguments{
\item{data}{A \link{data.frame} with column(s) of class \code{\link{sir}} (see \code{\link[=as.sir]{as.sir()}}).}

View File

@@ -4,8 +4,12 @@
\alias{guess_ab_col}
\title{Guess Antibiotic Column}
\usage{
guess_ab_col(x = NULL, search_string = NULL, verbose = FALSE,
only_sir_columns = FALSE)
guess_ab_col(
x = NULL,
search_string = NULL,
verbose = FALSE,
only_sir_columns = FALSE
)
}
\arguments{
\item{x}{A \link{data.frame}.}

View File

@@ -8,21 +8,42 @@
\alias{eucast_dosage}
\title{Apply Interpretive Rules}
\usage{
interpretive_rules(x, col_mo = NULL, info = interactive(),
interpretive_rules(
x,
col_mo = NULL,
info = interactive(),
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
"expected_phenotypes")), guideline = getOption("AMR_guideline", "EUCAST"),
verbose = FALSE, version_breakpoints = 16,
version_expected_phenotypes = 1.2, version_expertrules = 3.3,
ampc_cephalosporin_resistance = NA, only_sir_columns = any(is.sir(x)),
custom_rules = NULL, overwrite = FALSE, add_if_missing = TRUE, ...)
"expected_phenotypes")),
guideline = getOption("AMR_guideline", "EUCAST"),
verbose = FALSE,
version_breakpoints = 16,
version_expected_phenotypes = 1.2,
version_expertrules = 3.3,
ampc_cephalosporin_resistance = NA,
only_sir_columns = any(is.sir(x)),
custom_rules = NULL,
overwrite = FALSE,
add_if_missing = TRUE,
...
)
eucast_rules(x, col_mo = NULL, info = interactive(),
eucast_rules(
x,
col_mo = NULL,
info = interactive(),
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
"expected_phenotypes")), ...)
"expected_phenotypes")),
...
)
clsi_rules(x, col_mo = NULL, info = interactive(),
clsi_rules(
x,
col_mo = NULL,
info = interactive(),
rules = getOption("AMR_interpretive_rules", default = c("breakpoints",
"expected_phenotypes")), ...)
"expected_phenotypes")),
...
)
eucast_dosage(ab, administration = "iv", version_breakpoints = 15)
}

View File

@@ -6,19 +6,31 @@
\alias{antimicrobials_equal}
\title{(Key) Antimicrobials for First Weighted Isolates}
\usage{
key_antimicrobials(x = NULL, col_mo = NULL, universal = c("ampicillin",
"amoxicillin/clavulanic acid", "cefuroxime", "piperacillin/tazobactam",
"ciprofloxacin", "trimethoprim/sulfamethoxazole"),
gram_negative = c("gentamicin", "tobramycin", "colistin", "cefotaxime",
"ceftazidime", "meropenem"), gram_positive = c("vancomycin", "teicoplanin",
"tetracycline", "erythromycin", "oxacillin", "rifampin"),
antifungal = c("anidulafungin", "caspofungin", "fluconazole", "miconazole",
"nystatin", "voriconazole"), only_sir_columns = any(is.sir(x)), ...)
key_antimicrobials(
x = NULL,
col_mo = NULL,
universal = c("ampicillin", "amoxicillin/clavulanic acid", "cefuroxime",
"piperacillin/tazobactam", "ciprofloxacin", "trimethoprim/sulfamethoxazole"),
gram_negative = c("gentamicin", "tobramycin", "colistin", "cefotaxime", "ceftazidime",
"meropenem"),
gram_positive = c("vancomycin", "teicoplanin", "tetracycline", "erythromycin",
"oxacillin", "rifampin"),
antifungal = c("anidulafungin", "caspofungin", "fluconazole", "miconazole", "nystatin",
"voriconazole"),
only_sir_columns = any(is.sir(x)),
...
)
all_antimicrobials(x = NULL, only_sir_columns = any(is.sir(x)), ...)
antimicrobials_equal(y, z, type = c("points", "keyantimicrobials"),
ignore_I = TRUE, points_threshold = 2, ...)
antimicrobials_equal(
y,
z,
type = c("points", "keyantimicrobials"),
ignore_I = TRUE,
points_threshold = 2,
...
)
}
\arguments{
\item{x}{A \link{data.frame} with antimicrobials columns, like \code{AMX} or \code{amox}. Can be left blank to determine automatically.}

View File

@@ -15,11 +15,24 @@
\alias{eucast_exceptional_phenotypes}
\title{Determine Multidrug-Resistant Organisms (MDRO)}
\usage{
mdro(x = NULL, guideline = "CMI 2012", col_mo = NULL, esbl = NA,
carbapenemase = NA, mecA = NA, mecC = NA, vanA = NA, vanB = NA,
info = interactive(), pct_required_classes = 0.5, combine_SI = TRUE,
verbose = FALSE, only_sir_columns = any(is.sir(x)),
infer_from_combinations = TRUE, ...)
mdro(
x = NULL,
guideline = "CMI 2012",
col_mo = NULL,
esbl = NA,
carbapenemase = NA,
mecA = NA,
mecC = NA,
vanA = NA,
vanB = NA,
info = interactive(),
pct_required_classes = 0.5,
combine_SI = TRUE,
verbose = FALSE,
only_sir_columns = any(is.sir(x)),
infer_from_combinations = TRUE,
...
)
brmo(x = NULL, only_sir_columns = any(is.sir(x)), ...)
@@ -27,11 +40,14 @@ mrgn(x = NULL, only_sir_columns = any(is.sir(x)), verbose = FALSE, ...)
mdr_tb(x = NULL, only_sir_columns = any(is.sir(x)), verbose = FALSE, ...)
mdr_cmi2012(x = NULL, only_sir_columns = any(is.sir(x)), verbose = FALSE,
...)
mdr_cmi2012(x = NULL, only_sir_columns = any(is.sir(x)), verbose = FALSE, ...)
eucast_exceptional_phenotypes(x = NULL, only_sir_columns = any(is.sir(x)),
verbose = FALSE, ...)
eucast_exceptional_phenotypes(
x = NULL,
only_sir_columns = any(is.sir(x)),
verbose = FALSE,
...
)
}
\arguments{
\item{x}{A \link{data.frame} with antimicrobials columns, like \code{AMX} or \code{amox}. Can be left blank for automatic determination.}

View File

@@ -41,119 +41,270 @@
\alias{mo_url}
\title{Get Properties of a Microorganism}
\usage{
mo_name(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_fullname(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_shortname(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_subspecies(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_species(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_genus(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_family(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_order(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_class(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_phylum(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_kingdom(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_domain(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_type(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_status(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_pathogenicity(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_gramstain(x, language = get_AMR_locale(),
mo_name(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
add_morphology = FALSE, ...)
...
)
mo_is_gram_negative(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_fullname(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_is_gram_positive(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_shortname(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_is_yeast(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_subspecies(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_is_intrinsic_resistant(x, ab, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_species(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_oxygen_tolerance(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_genus(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_is_anaerobic(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_family(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_morphology(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_order(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_snomed(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_class(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_ref(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_phylum(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_authors(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_kingdom(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_year(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_domain(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_lpsn(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_type(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_mycobank(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_status(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_gbif(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_pathogenicity(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_rank(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_gramstain(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
add_morphology = FALSE,
...
)
mo_taxonomy(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_is_gram_negative(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_synonyms(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_is_gram_positive(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_is_yeast(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_is_intrinsic_resistant(
x,
ab,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_oxygen_tolerance(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_is_anaerobic(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_morphology(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_snomed(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_ref(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_authors(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_year(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_lpsn(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_mycobank(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_gbif(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_rank(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_taxonomy(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_synonyms(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_current(x, language = get_AMR_locale(), ...)
mo_group_members(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_group_members(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_info(x, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_info(
x,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_url(x, open = FALSE, language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_url(
x,
open = FALSE,
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
mo_property(x, property = "fullname", language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE), ...)
mo_property(
x,
property = "fullname",
language = get_AMR_locale(),
keep_synonyms = getOption("AMR_keep_synonyms", FALSE),
...
)
}
\arguments{
\item{x}{Any \link{character} (vector) that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}. Can be left blank for auto-guessing the column containing microorganism codes if used in a data set, see \emph{Examples}.}

View File

@@ -6,8 +6,10 @@
\alias{get_mo_source}
\title{User-Defined Reference Data Set for Microorganisms}
\usage{
set_mo_source(path, destination = getOption("AMR_mo_source",
"~/mo_source.rds"))
set_mo_source(
path,
destination = getOption("AMR_mo_source", "~/mo_source.rds")
)
get_mo_source(destination = getOption("AMR_mo_source", "~/mo_source.rds"))
}

View File

@@ -4,8 +4,15 @@
\alias{pca}
\title{Principal Component Analysis (for AMR)}
\usage{
pca(x, ..., retx = TRUE, center = TRUE, scale. = TRUE, tol = NULL,
rank. = NULL)
pca(
x,
...,
retx = TRUE,
center = TRUE,
scale. = TRUE,
tol = NULL,
rank. = NULL
)
}
\arguments{
\item{x}{A \link{data.frame} containing \link{numeric} columns.}

View File

@@ -33,80 +33,135 @@ scale_colour_mic(keep_operators = "edges", mic_range = NULL, ...)
scale_fill_mic(keep_operators = "edges", mic_range = NULL, ...)
scale_x_sir(colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R
= "#ED553B"), language = get_AMR_locale(),
eucast_I = getOption("AMR_guideline", "EUCAST") == "EUCAST", ...)
scale_x_sir(
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
eucast_I = getOption("AMR_guideline", "EUCAST") == "EUCAST",
...
)
scale_colour_sir(colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I =
"#F6D55C", R = "#ED553B"), language = get_AMR_locale(),
eucast_I = getOption("AMR_guideline", "EUCAST") == "EUCAST", ...)
scale_colour_sir(
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
eucast_I = getOption("AMR_guideline", "EUCAST") == "EUCAST",
...
)
scale_fill_sir(colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C",
R = "#ED553B"), language = get_AMR_locale(),
eucast_I = getOption("AMR_guideline", "EUCAST") == "EUCAST", ...)
scale_fill_sir(
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
eucast_I = getOption("AMR_guideline", "EUCAST") == "EUCAST",
...
)
\method{plot}{mic}(x, mo = NULL, ab = NULL,
\method{plot}{mic}(
x,
mo = NULL,
ab = NULL,
guideline = getOption("AMR_guideline", "EUCAST"),
main = deparse(substitute(x)), ylab = translate_AMR("Frequency", language
= language),
xlab = translate_AMR("Minimum Inhibitory Concentration (mg/L)", language =
language), colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R
= "#ED553B"), language = get_AMR_locale(), expand = TRUE,
main = deparse(substitute(x)),
ylab = translate_AMR("Frequency", language = language),
xlab = translate_AMR("Minimum Inhibitory Concentration (mg/L)", language = language),
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
expand = TRUE,
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), ...)
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
...
)
\method{autoplot}{mic}(object, mo = NULL, ab = NULL,
\method{autoplot}{mic}(
object,
mo = NULL,
ab = NULL,
guideline = getOption("AMR_guideline", "EUCAST"),
title = deparse(substitute(object)), ylab = translate_AMR("Frequency",
language = language),
xlab = translate_AMR("Minimum Inhibitory Concentration (mg/L)", language =
language), colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R
= "#ED553B"), language = get_AMR_locale(), expand = TRUE,
title = deparse(substitute(object)),
ylab = translate_AMR("Frequency", language = language),
xlab = translate_AMR("Minimum Inhibitory Concentration (mg/L)", language = language),
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
expand = TRUE,
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), ...)
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
...
)
\method{plot}{disk}(x, main = deparse(substitute(x)),
\method{plot}{disk}(
x,
main = deparse(substitute(x)),
ylab = translate_AMR("Frequency", language = language),
xlab = translate_AMR("Disk diffusion diameter (mm)", language = language),
mo = NULL, ab = NULL, guideline = getOption("AMR_guideline", "EUCAST"),
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R =
"#ED553B"), language = get_AMR_locale(), expand = TRUE,
mo = NULL,
ab = NULL,
guideline = getOption("AMR_guideline", "EUCAST"),
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
expand = TRUE,
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), ...)
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
...
)
\method{autoplot}{disk}(object, mo = NULL, ab = NULL,
title = deparse(substitute(object)), ylab = translate_AMR("Frequency",
language = language), xlab = translate_AMR("Disk diffusion diameter (mm)",
language = language), guideline = getOption("AMR_guideline", "EUCAST"),
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R =
"#ED553B"), language = get_AMR_locale(), expand = TRUE,
\method{autoplot}{disk}(
object,
mo = NULL,
ab = NULL,
title = deparse(substitute(object)),
ylab = translate_AMR("Frequency", language = language),
xlab = translate_AMR("Disk diffusion diameter (mm)", language = language),
guideline = getOption("AMR_guideline", "EUCAST"),
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
expand = TRUE,
include_PKPD = getOption("AMR_include_PKPD", TRUE),
breakpoint_type = getOption("AMR_breakpoint_type", "human"), ...)
breakpoint_type = getOption("AMR_breakpoint_type", "human"),
...
)
\method{plot}{sir}(x, ylab = translate_AMR("Percentage", language =
language), xlab = translate_AMR("Antimicrobial Interpretation", language =
language), main = deparse(substitute(x)), language = get_AMR_locale(),
...)
\method{autoplot}{sir}(object, title = deparse(substitute(object)),
\method{plot}{sir}(
x,
ylab = translate_AMR("Percentage", language = language),
xlab = translate_AMR("Antimicrobial Interpretation", language = language),
ylab = translate_AMR("Frequency", language = language), colours_SIR = c(S
= "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(), ...)
main = deparse(substitute(x)),
language = get_AMR_locale(),
...
)
\method{autoplot}{sir}(
object,
title = deparse(substitute(object)),
xlab = translate_AMR("Antimicrobial Interpretation", language = language),
ylab = translate_AMR("Frequency", language = language),
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B"),
language = get_AMR_locale(),
...
)
facet_sir(facet = c("interpretation", "antibiotic"), nrow = NULL)
scale_y_percent(breaks = function(x) seq(0, max(x, na.rm = TRUE), 0.1),
limits = c(0, NA))
scale_y_percent(
breaks = function(x) seq(0, max(x, na.rm = TRUE), 0.1),
limits = c(0, NA)
)
scale_sir_colours(..., aesthetics, colours_SIR = c(S = "#3CAEA3", SDD =
"#8FD6C4", I = "#F6D55C", R = "#ED553B"))
scale_sir_colours(
...,
aesthetics,
colours_SIR = c(S = "#3CAEA3", SDD = "#8FD6C4", I = "#F6D55C", R = "#ED553B")
)
theme_sir()
labels_sir_count(position = NULL, x = "antibiotic",
translate_ab = "name", minimum = 30, language = get_AMR_locale(),
combine_SI = TRUE, datalabels.size = 3, datalabels.colour = "grey15")
labels_sir_count(
position = NULL,
x = "antibiotic",
translate_ab = "name",
minimum = 30,
language = get_AMR_locale(),
combine_SI = TRUE,
datalabels.size = 3,
datalabels.colour = "grey15"
)
}
\arguments{
\item{keep_operators}{A \link{character} specifying how to handle operators (such as \code{>} and \code{<=}) in the input. Accepts one of three values: \code{"all"} (or \code{TRUE}) to keep all operators, \code{"none"} (or \code{FALSE}) to remove all operators, or \code{"edges"} to keep operators only at both ends of the range.}

View File

@@ -15,40 +15,62 @@
\alias{sir_df}
\title{Calculate Antimicrobial Resistance}
\usage{
resistance(..., minimum = 30, as_percent = FALSE,
only_all_tested = FALSE, guideline = getOption("AMR_guideline",
"EUCAST"))
resistance(
...,
minimum = 30,
as_percent = FALSE,
only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST")
)
susceptibility(..., minimum = 30, as_percent = FALSE,
only_all_tested = FALSE, guideline = getOption("AMR_guideline",
"EUCAST"))
susceptibility(
...,
minimum = 30,
as_percent = FALSE,
only_all_tested = FALSE,
guideline = getOption("AMR_guideline", "EUCAST")
)
sir_confidence_interval(..., ab_result = "R", minimum = 30,
as_percent = FALSE, only_all_tested = FALSE, confidence_level = 0.95,
side = "both", collapse = FALSE)
sir_confidence_interval(
...,
ab_result = "R",
minimum = 30,
as_percent = FALSE,
only_all_tested = FALSE,
confidence_level = 0.95,
side = "both",
collapse = FALSE
)
proportion_R(..., minimum = 30, as_percent = FALSE,
only_all_tested = FALSE)
proportion_R(..., minimum = 30, as_percent = FALSE, only_all_tested = FALSE)
proportion_IR(..., minimum = 30, as_percent = FALSE,
only_all_tested = FALSE)
proportion_IR(..., minimum = 30, as_percent = FALSE, only_all_tested = FALSE)
proportion_I(..., minimum = 30, as_percent = FALSE,
only_all_tested = FALSE)
proportion_I(..., minimum = 30, as_percent = FALSE, only_all_tested = FALSE)
proportion_SI(..., minimum = 30, as_percent = FALSE,
only_all_tested = FALSE)
proportion_SI(..., minimum = 30, as_percent = FALSE, only_all_tested = FALSE)
proportion_S(..., minimum = 30, as_percent = FALSE,
only_all_tested = FALSE)
proportion_S(..., minimum = 30, as_percent = FALSE, only_all_tested = FALSE)
proportion_df(data, translate_ab = "name", language = get_AMR_locale(),
minimum = 30, as_percent = FALSE, combine_SI = TRUE,
confidence_level = 0.95)
proportion_df(
data,
translate_ab = "name",
language = get_AMR_locale(),
minimum = 30,
as_percent = FALSE,
combine_SI = TRUE,
confidence_level = 0.95
)
sir_df(data, translate_ab = "name", language = get_AMR_locale(),
minimum = 30, as_percent = FALSE, combine_SI = TRUE,
confidence_level = 0.95)
sir_df(
data,
translate_ab = "name",
language = get_AMR_locale(),
minimum = 30,
as_percent = FALSE,
combine_SI = TRUE,
confidence_level = 0.95
)
}
\arguments{
\item{...}{One or more vectors (or columns) with antibiotic interpretations. They will be transformed internally with \code{\link[=as.sir]{as.sir()}} if needed. Use multiple columns to calculate (the lack of) co-resistance: the probability where one of two drugs have a resistant or susceptible result. See \emph{Examples}.}

View File

@@ -7,11 +7,23 @@
\alias{random_sir}
\title{Random MIC Values/Disk Zones/SIR Generation}
\usage{
random_mic(size = NULL, mo = NULL, ab = NULL, skew = "right",
severity = 1, ...)
random_mic(
size = NULL,
mo = NULL,
ab = NULL,
skew = "right",
severity = 1,
...
)
random_disk(size = NULL, mo = NULL, ab = NULL, skew = "left",
severity = 1, ...)
random_disk(
size = NULL,
mo = NULL,
ab = NULL,
skew = "left",
severity = 1,
...
)
random_sir(size = NULL, prob_SIR = c(0.33, 0.33, 0.33), ...)
}

View File

@@ -8,22 +8,51 @@
\alias{autoplot.resistance_predict}
\title{Predict Antimicrobial Resistance}
\usage{
resistance_predict(x, col_ab, col_date = NULL, year_min = NULL,
year_max = NULL, year_every = 1, minimum = 30, model = NULL,
I_as_S = TRUE, preserve_measurements = TRUE, info = interactive(), ...)
resistance_predict(
x,
col_ab,
col_date = NULL,
year_min = NULL,
year_max = NULL,
year_every = 1,
minimum = 30,
model = NULL,
I_as_S = TRUE,
preserve_measurements = TRUE,
info = interactive(),
...
)
sir_predict(x, col_ab, col_date = NULL, year_min = NULL, year_max = NULL,
year_every = 1, minimum = 30, model = NULL, I_as_S = TRUE,
preserve_measurements = TRUE, info = interactive(), ...)
sir_predict(
x,
col_ab,
col_date = NULL,
year_min = NULL,
year_max = NULL,
year_every = 1,
minimum = 30,
model = NULL,
I_as_S = TRUE,
preserve_measurements = TRUE,
info = interactive(),
...
)
\method{plot}{resistance_predict}(x, main = paste("Resistance Prediction of",
x_name), ...)
\method{plot}{resistance_predict}(x, main = paste("Resistance Prediction of", x_name), ...)
ggplot_sir_predict(x, main = paste("Resistance Prediction of", x_name),
ribbon = TRUE, ...)
ggplot_sir_predict(
x,
main = paste("Resistance Prediction of", x_name),
ribbon = TRUE,
...
)
\method{autoplot}{resistance_predict}(object,
main = paste("Resistance Prediction of", x_name), ribbon = TRUE, ...)
\method{autoplot}{resistance_predict}(
object,
main = paste("Resistance Prediction of", x_name),
ribbon = TRUE,
...
)
}
\arguments{
\item{x}{A \link{data.frame} containing isolates. Can be left blank for automatic determination, see \emph{Examples}.}

View File

@@ -4,8 +4,14 @@
\alias{top_n_microorganisms}
\title{Filter Top \emph{n} Microorganisms}
\usage{
top_n_microorganisms(x, n, property = "species", n_for_each = NULL,
col_mo = NULL, ...)
top_n_microorganisms(
x,
n,
property = "species",
n_for_each = NULL,
col_mo = NULL,
...
)
}
\arguments{
\item{x}{A data frame containing microbial data.}