mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 11:51:59 +02:00
(v1.6.0.9063) prepare new release
This commit is contained in:
@ -115,7 +115,7 @@ example_isolates[any(carbapenems() == "R"), penicillins()]
|
||||
|
||||
|
||||
# dplyr -------------------------------------------------------------------
|
||||
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
|
||||
# this will select columns 'IPM' (imipenem) and 'MEM' (meropenem):
|
||||
@ -165,3 +165,4 @@ if (require("dplyr")) {
|
||||
example_isolates \%>\% filter(across(carbapenems(), ~.x == "R"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,13 +102,14 @@ ab_atc("seephthriaaksone") # and even this works
|
||||
# they use as.ab() internally:
|
||||
ab_name("J01FA01") # "Erythromycin"
|
||||
ab_name("eryt") # "Erythromycin"
|
||||
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
|
||||
# you can quickly rename <rsi> columns using dplyr >= 1.0.0:
|
||||
example_isolates \%>\%
|
||||
rename_with(as.ab, where(is.rsi))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
|
@ -161,12 +161,12 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
|
||||
\examples{
|
||||
summary(example_isolates) # see all R/SI results at a glance
|
||||
|
||||
\donttest{
|
||||
if (require("skimr")) {
|
||||
# class <rsi> supported in skim() too:
|
||||
skim(example_isolates)
|
||||
}
|
||||
|
||||
}
|
||||
# For INTERPRETING disk diffusion and MIC values -----------------------
|
||||
|
||||
# a whole data set, even with combined MIC values and disk zones
|
||||
|
@ -80,7 +80,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
\donttest{
|
||||
\dontrun{
|
||||
# oral DDD (Defined Daily Dose) of amoxicillin
|
||||
atc_online_property("J01CA04", "DDD", "O")
|
||||
|
||||
|
@ -35,7 +35,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
|
||||
\examples{
|
||||
availability(example_isolates)
|
||||
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
filter(mo == as.mo("E. coli")) \%>\%
|
||||
@ -43,3 +43,4 @@ if (require("dplyr")) {
|
||||
availability()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ n_rsi(example_isolates$AMX)
|
||||
count_susceptible(example_isolates$AMX)
|
||||
susceptibility(example_isolates$AMX) * n_rsi(example_isolates$AMX)
|
||||
|
||||
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
group_by(hospital_id) \%>\%
|
||||
@ -192,6 +192,7 @@ if (require("dplyr")) {
|
||||
count_df(translate = FALSE)
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
\code{\link[=proportion]{proportion_*}} to calculate microbial resistance and susceptibility.
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ If the unlying code needs breaking changes, they will occur gradually. For examp
|
||||
# See ?example_isolates.
|
||||
|
||||
# See ?pca for more info about Principal Component Analysis (PCA).
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
pca_model <- example_isolates \%>\%
|
||||
filter(mo_genus(mo) == "Staphylococcus") \%>\%
|
||||
@ -141,3 +142,4 @@ if (require("dplyr")) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,6 +154,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
\donttest{
|
||||
if (require("ggplot2") & require("dplyr")) {
|
||||
|
||||
# get antimicrobial results for drugs against a UTI:
|
||||
@ -203,7 +204,6 @@ if (require("ggplot2") & require("dplyr")) {
|
||||
scale_rsi_colours(Value4 = "S", Value5 = "I", Value6 = "R")
|
||||
}
|
||||
|
||||
\donttest{
|
||||
# resistance of ciprofloxacine per age group
|
||||
example_isolates \%>\%
|
||||
mutate(first_isolate = first_isolate(.)) \%>\%
|
||||
|
@ -33,6 +33,7 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
}
|
||||
|
||||
\examples{
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
intrinsic_resistant \%>\%
|
||||
filter(antibiotic == "Vancomycin", microorganism \%like\% "Enterococcus") \%>\%
|
||||
@ -40,4 +41,5 @@ if (require("dplyr")) {
|
||||
# [1] "Enterococcus casseliflavus" "Enterococcus gallinarum"
|
||||
}
|
||||
}
|
||||
}
|
||||
\keyword{datasets}
|
||||
|
@ -43,10 +43,11 @@ cat(italicise_taxonomy("An overview of S. aureus isolates", type = "ansi"))
|
||||
|
||||
# since ggplot2 supports no markdown (yet), use
|
||||
# italicise_taxonomy() and the `ggtext` pkg for titles:
|
||||
|
||||
\donttest{
|
||||
if (require("ggplot2") && require("ggtext")) {
|
||||
ggplot(example_isolates$AMC,
|
||||
title = italicise_taxonomy("Amoxi/clav in E. coli")) +
|
||||
theme(plot.title = ggtext::element_markdown())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,6 +280,7 @@ mo_fullname("S. pyogenes",
|
||||
mo_is_yeast(c("Candida", "E. coli")) # TRUE, FALSE
|
||||
|
||||
# gram stains and intrinsic resistance can also be used as a filter in dplyr verbs
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
filter(mo_is_gram_positive())
|
||||
@ -296,6 +297,7 @@ mo_taxonomy("E. coli")
|
||||
mo_info("E. coli")
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
\link{microorganisms}
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ On our website \url{https://msberends.github.io/AMR/} you can find \href{https:/
|
||||
# See ?example_isolates.
|
||||
|
||||
\donttest{
|
||||
|
||||
if (require("dplyr")) {
|
||||
# calculate the resistance per group first
|
||||
resistance_data <- example_isolates \%>\%
|
||||
|
@ -149,9 +149,11 @@ plot(some_rsi_values)
|
||||
plot(some_mic_values, mo = "S. aureus", ab = "ampicillin")
|
||||
plot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||
|
||||
\donttest{
|
||||
if (require("ggplot2")) {
|
||||
ggplot(some_mic_values)
|
||||
ggplot(some_disk_values, mo = "Escherichia coli", ab = "cipro")
|
||||
ggplot(some_rsi_values)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +160,7 @@ proportion_I(example_isolates$AMX)
|
||||
proportion_IR(example_isolates$AMX)
|
||||
proportion_R(example_isolates$AMX)
|
||||
|
||||
\donttest{
|
||||
if (require("dplyr")) {
|
||||
example_isolates \%>\%
|
||||
group_by(hospital_id) \%>\%
|
||||
@ -219,6 +220,7 @@ if (require("dplyr")) {
|
||||
proportion_df(translate = FALSE)
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
\code{\link[=count]{count()}} to count resistant and susceptible isolates.
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ x <- resistance_predict(example_isolates,
|
||||
year_min = 2010,
|
||||
model = "binomial")
|
||||
plot(x)
|
||||
\donttest{
|
||||
if (require("ggplot2")) {
|
||||
ggplot_rsi_predict(x)
|
||||
}
|
||||
@ -182,6 +183,7 @@ if (require("dplyr") & require("ggplot2")) {
|
||||
theme_minimal(base_size = 13)
|
||||
}
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
The \code{\link[=proportion]{proportion()}} functions to calculate resistance
|
||||
|
||||
|
Reference in New Issue
Block a user