mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 00:02:38 +02:00
(v1.1.0.9004) lose dependencies
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
% Please edit documentation in R/deprecated.R
|
||||
\name{AMR-deprecated}
|
||||
\alias{AMR-deprecated}
|
||||
\alias{p.symbol}
|
||||
\alias{portion_R}
|
||||
\alias{portion_IR}
|
||||
\alias{portion_I}
|
||||
@ -11,8 +10,6 @@
|
||||
\alias{portion_df}
|
||||
\title{Deprecated functions}
|
||||
\usage{
|
||||
p.symbol(...)
|
||||
|
||||
portion_R(...)
|
||||
|
||||
portion_IR(...)
|
||||
|
@ -1,13 +1,19 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/vctrs.R
|
||||
\name{AMR-vctrs}
|
||||
\alias{AMR-vctrs}
|
||||
% Please edit documentation in R/tidyverse.R
|
||||
\name{AMR-tidyverse}
|
||||
\alias{AMR-tidyverse}
|
||||
\alias{scale_type.mo}
|
||||
\alias{scale_type.ab}
|
||||
\alias{vec_ptype2.mo}
|
||||
\alias{vec_cast.mo}
|
||||
\alias{vec_ptype2.ab}
|
||||
\alias{vec_cast.ab}
|
||||
\title{\code{vctrs} methods}
|
||||
\title{Methods for tidyverse}
|
||||
\usage{
|
||||
scale_type.mo(x)
|
||||
|
||||
scale_type.ab(x)
|
||||
|
||||
vec_ptype2.mo(x, y, ...)
|
||||
|
||||
vec_cast.mo(x, to, ...)
|
@ -56,7 +56,6 @@ as.rsi(x = as.mic(4),
|
||||
|
||||
plot(mic_data)
|
||||
barplot(mic_data)
|
||||
freq(mic_data)
|
||||
}
|
||||
\seealso{
|
||||
\code{\link[=as.rsi]{as.rsi()}}
|
||||
|
@ -39,7 +39,7 @@ This excludes \emph{Enterococci} at default (who are in group D), use \code{Lanc
|
||||
|
||||
\item{allow_uncertain}{a number between \code{0} (or \code{"none"}) and \code{3} (or \code{"all"}), or \code{TRUE} (= \code{2}) or \code{FALSE} (= \code{0}) to indicate whether the input should be checked for less probable results, please see \emph{Details}}
|
||||
|
||||
\item{reference_df}{a \code{\link{data.frame}} to use for extra reference when translating \code{x} to a valid \code{\link{mo}}. See \code{\link[=set_mo_source]{set_mo_source()}} and \code{\link[=get_mo_source]{get_mo_source()}} to automate the usage of your own codes (e.g. used in your analysis or organisation).}
|
||||
\item{reference_df}{a \code{\link{data.frame}} to be used for extra reference when translating \code{x} to a valid \code{\link{mo}}. See \code{\link[=set_mo_source]{set_mo_source()}} and \code{\link[=get_mo_source]{get_mo_source()}} to automate the usage of your own codes (e.g. used in your analysis or organisation).}
|
||||
|
||||
\item{...}{other parameters passed on to functions}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ is.rsi.eligible(x, threshold = 0.05)
|
||||
|
||||
\item{ab}{any (vector of) text that can be coerced to a valid antimicrobial code with \code{\link[=as.ab]{as.ab()}}}
|
||||
|
||||
\item{guideline}{defaults to the latest included EUCAST guideline, run \code{unique(rsi_translation$guideline)} for all options}
|
||||
\item{guideline}{defaults to the latest included EUCAST guideline, see Details for all options}
|
||||
|
||||
\item{uti}{(Urinary Tract Infection) A vector with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.rsi]{as.rsi()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be search for a 'specimen' and rows containing 'urin' in that column will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||
|
||||
@ -60,9 +60,11 @@ Ordered factor with new class \code{\link{rsi}}
|
||||
Interpret MIC values and disk diffusion diameters according to EUCAST or CLSI, or clean up existing R/SI values. This transforms the input to a new class \code{\link{rsi}}, which is an ordered factor with levels \verb{S < I < R}. Invalid antimicrobial interpretations will be translated as \code{NA} with a warning.
|
||||
}
|
||||
\details{
|
||||
Run \code{unique(rsi_translation$guideline)} for a list of all supported guidelines. The repository of this package contains \href{https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt}{this machine readable version} of these guidelines.
|
||||
When using \code{\link[=as.rsi]{as.rsi()}} on untransformed data, the data will be cleaned to only contain values S, I and R. When using the function on data with class \code{\link{mic}} (using \code{\link[=as.mic]{as.mic()}}) or class \code{\link{disk}} (using \code{\link[=as.disk]{as.disk()}}), the data will be interpreted based on the guideline set with the \code{guideline} parameter.
|
||||
|
||||
These guidelines are machine readable, since \href{https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt}{}.
|
||||
Supported guidelines to be used as input for the \code{guideline} parameter are: "CLSI 2010", "CLSI 2011", "CLSI 2012", "CLSI 2013", "CLSI 2014", "CLSI 2015", "CLSI 2016", "CLSI 2017", "CLSI 2018", "CLSI 2019", "EUCAST 2011", "EUCAST 2012", "EUCAST 2013", "EUCAST 2014", "EUCAST 2015", "EUCAST 2016", "EUCAST 2017", "EUCAST 2018", "EUCAST 2019", "EUCAST 2020". Simply using \code{"CLSI"} or \code{"EUCAST"} for input will automatically select the latest version of that guideline.
|
||||
|
||||
The repository of this package \href{https://gitlab.com/msberends/AMR/blob/master/data-raw/rsi_translation.txt}{contains a machine readable version} of all guidelines. This is a CSV file consisting of 18,964 rows and 10 columns. This file is machine readable, since it contains one row for every unique combination of the test method (MIC or disk diffusion), the antimicrobial agent and the microorganism. This \strong{allows for easy implementation of these rules in laboratory information systems (LIS)}.
|
||||
|
||||
After using \code{\link[=as.rsi]{as.rsi()}}, you can use \code{\link[=eucast_rules]{eucast_rules()}} to (1) apply inferred susceptibility and resistance based on results of other antimicrobials and (2) apply intrinsic resistance based on taxonomic properties of a microorganism.
|
||||
|
||||
@ -154,7 +156,6 @@ rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||
is.rsi(rsi_data)
|
||||
plot(rsi_data) # for percentages
|
||||
barplot(rsi_data) # for frequencies
|
||||
freq(rsi_data) # frequency table with informative header
|
||||
|
||||
library(dplyr)
|
||||
example_isolates \%>\%
|
||||
|
@ -28,11 +28,6 @@ This package contains the complete taxonomic tree of almost all microorganisms (
|
||||
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
|
||||
}
|
||||
|
||||
\examples{
|
||||
library(dplyr)
|
||||
microorganisms \%>\% freq(kingdom)
|
||||
microorganisms \%>\% group_by(kingdom) \%>\% freq(phylum, nmax = NULL)
|
||||
}
|
||||
\seealso{
|
||||
\link{microorganisms}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ The function \code{\link[=count_resistant]{count_resistant()}} is equal to the f
|
||||
|
||||
The function \code{\link[=n_rsi]{n_rsi()}} is an alias of \code{\link[=count_all]{count_all()}}. They can be used to count all available isolates, i.e. where all input antibiotics have an available result (S, I or R). Their use is equal to \code{\link[=n_distinct]{n_distinct()}}. Their function is equal to \code{count_susceptible(...) + count_resistant(...)}.
|
||||
|
||||
The function \code{\link[=count_df]{count_df()}} takes any variable from \code{data} that has an \code{\link{rsi}} class (created with \code{\link[=as.rsi]{as.rsi()}}) and counts the number of S's, I's and R's. The function \code{\link[=rsi_df]{rsi_df()}} works exactly like \code{\link[=count_df]{count_df()}}, but adds the percentage of S, I and R.
|
||||
The function \code{\link[=count_df]{count_df()}} takes any variable from \code{data} that has an \code{\link{rsi}} class (created with \code{\link[=as.rsi]{as.rsi()}}) and counts the number of S's, I's and R's. It also supports grouped variables. The function \code{\link[=rsi_df]{rsi_df()}} works exactly like \code{\link[=count_df]{count_df()}}, but adds the percentage of S, I and R.
|
||||
}
|
||||
\section{Stable lifecycle}{
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/extended.R
|
||||
\name{extended-functions}
|
||||
\alias{extended-functions}
|
||||
\alias{scale_type.mo}
|
||||
\alias{scale_type.ab}
|
||||
\title{Extended functions}
|
||||
\usage{
|
||||
scale_type.mo(x)
|
||||
|
||||
scale_type.ab(x)
|
||||
}
|
||||
\description{
|
||||
These functions are extensions of functions in other packages.
|
||||
}
|
||||
\section{Stable lifecycle}{
|
||||
|
||||
\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr}
|
||||
The \link[AMR:lifecycle]{lifecycle} of this function is \strong{stable}. In a stable function, we are largely happy with the unlying code, and major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; we will avoid removing arguments or changing the meaning of existing arguments.
|
||||
|
||||
If the unlying code needs breaking changes, they will occur gradually. To begin with, the function or argument will be deprecated; it will continue to work but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
|
||||
}
|
||||
|
||||
\section{Read more on our website!}{
|
||||
|
||||
On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://msberends.gitlab.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.gitlab.io/AMR/reference}{complete documentation of all functions} (which reads a lot easier than here in R) and \href{https://msberends.gitlab.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}.
|
||||
}
|
||||
|
||||
\keyword{internal}
|
@ -14,7 +14,7 @@
|
||||
\alias{filter_glycopeptides}
|
||||
\alias{filter_macrolides}
|
||||
\alias{filter_tetracyclines}
|
||||
\title{Filter isolates on result in antibiotic class}
|
||||
\title{Filter isolates on result in antimicrobial class}
|
||||
\usage{
|
||||
filter_ab_class(x, ab_class, result = NULL, scope = "any", ...)
|
||||
|
||||
@ -54,7 +54,7 @@ filter_tetracyclines(x, result = NULL, scope = "any", ...)
|
||||
\item{...}{parameters passed on to \code{filter_at} from the \code{dplyr} package}
|
||||
}
|
||||
\description{
|
||||
Filter isolates on results in specific antibiotic variables based on their antibiotic class. This makes it easy to filter on isolates that were tested for e.g. any aminoglycoside.
|
||||
Filter isolates on results in specific antimicrobial classes. This makes it easy to filter on isolates that were tested for e.g. any aminoglycoside.
|
||||
}
|
||||
\details{
|
||||
The \code{group} column in \link{antibiotics} data set will be searched for \code{ab_class} (case-insensitive). If no results are found, the \code{atc_group1} and \code{atc_group2} columns will be searched. Next, \code{x} will be checked for column names with a value in any abbreviations, codes or official names found in the \link{antibiotics} data set.
|
||||
@ -68,6 +68,7 @@ If the unlying code needs breaking changes, they will occur gradually. To begin
|
||||
}
|
||||
|
||||
\examples{
|
||||
\dontrun{
|
||||
library(dplyr)
|
||||
|
||||
# filter on isolates that have any result for any aminoglycoside
|
||||
@ -97,3 +98,4 @@ example_isolates \%>\%
|
||||
filter_aminoglycosides("R", "all") \%>\%
|
||||
filter_fluoroquinolones("R", "all")
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
\alias{filter_first_weighted_isolate}
|
||||
\title{Determine first (weighted) isolates}
|
||||
\source{
|
||||
Methodology of this function is based on:
|
||||
Methodology of this function is strictly based on:
|
||||
|
||||
\strong{M39 Analysis and Presentation of Cumulative Antimicrobial Susceptibility Test Data, 4th Edition}, 2014, \emph{Clinical and Laboratory Standards Institute (CLSI)}. \url{https://clsi.org/standards/products/microbiology/documents/m39/}.
|
||||
}
|
||||
@ -142,6 +142,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
\dontrun{
|
||||
library(dplyr)
|
||||
# Filter on first isolates:
|
||||
example_isolates \%>\%
|
||||
@ -162,14 +163,12 @@ B <- example_isolates \%>\%
|
||||
|
||||
# Have a look at A and B.
|
||||
# B is more reliable because every isolate is counted only once.
|
||||
# Gentamicin resitance in hospital D appears to be 3.7\% higher than
|
||||
# Gentamicin resistance in hospital D appears to be 3.7\% higher than
|
||||
# when you (erroneously) would have used all isolates for analysis.
|
||||
|
||||
|
||||
## OTHER EXAMPLES:
|
||||
|
||||
\dontrun{
|
||||
|
||||
# Short-hand versions:
|
||||
example_isolates \%>\%
|
||||
filter_first_isolate()
|
||||
|
@ -114,6 +114,7 @@ The \link[AMR:lifecycle]{lifecycle} of this function is \strong{maturing}. The u
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
\dontrun{
|
||||
# See ?pca for more info about Principal Component Analysis (PCA).
|
||||
library(dplyr)
|
||||
pca_model <- example_isolates \%>\%
|
||||
@ -128,3 +129,4 @@ biplot(pca_model)
|
||||
# new
|
||||
ggplot_pca(pca_model)
|
||||
}
|
||||
}
|
||||
|
@ -219,29 +219,5 @@ example_isolates \%>\%
|
||||
title = "AMR of Anti-UTI Drugs Per Hospital",
|
||||
x.title = "Hospital",
|
||||
datalabels = FALSE)
|
||||
|
||||
# genuine analysis: check 3 most prevalent microorganisms
|
||||
example_isolates \%>\%
|
||||
# create new bacterial ID's, with all CoNS under the same group (Becker et al.)
|
||||
mutate(mo = as.mo(mo, Becker = TRUE)) \%>\%
|
||||
# filter on top three bacterial ID's
|
||||
filter(mo \%in\% top_freq(freq(.$mo), 3)) \%>\%
|
||||
# filter on first isolates
|
||||
filter_first_isolate() \%>\%
|
||||
# get short MO names (like "E. coli")
|
||||
mutate(bug = mo_shortname(mo, Becker = TRUE)) \%>\%
|
||||
# select this short name and some antiseptic drugs
|
||||
select(bug, CXM, GEN, CIP) \%>\%
|
||||
# group by MO
|
||||
group_by(bug) \%>\%
|
||||
# plot the thing, putting MOs on the facet
|
||||
ggplot_rsi(x = "antibiotic",
|
||||
facet = "bug",
|
||||
translate_ab = FALSE,
|
||||
nrow = 1,
|
||||
title = "AMR of Top Three Microorganisms In Blood Culture Isolates",
|
||||
subtitle = expression(paste("Only First Isolates, CoNS grouped according to Becker ",
|
||||
italic("et al."), " (2014)")),
|
||||
x.title = "Antibiotic (EARS-Net code)")
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
\alias{full_join_microorganisms}
|
||||
\alias{semi_join_microorganisms}
|
||||
\alias{anti_join_microorganisms}
|
||||
\title{Join a table with \link{microorganisms}}
|
||||
\title{Join \link{microorganisms} to a data set}
|
||||
\usage{
|
||||
inner_join_microorganisms(x, by = NULL, suffix = c("2", ""), ...)
|
||||
|
||||
@ -36,7 +36,9 @@ anti_join_microorganisms(x, by = NULL, ...)
|
||||
Join the data set \link{microorganisms} easily to an existing table or character vector.
|
||||
}
|
||||
\details{
|
||||
\strong{Note:} As opposed to the \code{\link[dplyr:join]{dplyr::join()}} functions of \code{dplyr}, \code{\link{character}} vectors are supported and at default existing columns will get a suffix \code{"2"} and the newly joined columns will not get a suffix. See \code{\link[dplyr:join]{dplyr::join()}} for more information.
|
||||
\strong{Note:} As opposed to the \code{\link[=join]{join()}} functions of \code{dplyr}, \code{\link{character}} vectors are supported and at default existing columns will get a suffix \code{"2"} and the newly joined columns will not get a suffix.
|
||||
|
||||
These functions rely on \code{\link[=merge]{merge()}}, a base R function to do joins.
|
||||
}
|
||||
\section{Stable lifecycle}{
|
||||
|
||||
@ -55,6 +57,7 @@ On our website \url{https://msberends.gitlab.io/AMR} you can find \href{https://
|
||||
left_join_microorganisms(as.mo("K. pneumoniae"))
|
||||
left_join_microorganisms("B_KLBSL_PNE")
|
||||
|
||||
\dontrun{
|
||||
library(dplyr)
|
||||
example_isolates \%>\% left_join_microorganisms()
|
||||
|
||||
@ -68,3 +71,4 @@ colnames(df)
|
||||
df_joined <- left_join_microorganisms(df, "bacteria")
|
||||
colnames(df_joined)
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,9 @@ key_antibiotics_equal(
|
||||
These function can be used to determine first isolates (see \code{\link[=first_isolate]{first_isolate()}}). Using key antibiotics to determine first isolates is more reliable than without key antibiotics. These selected isolates will then be called first \emph{weighted} isolates.
|
||||
}
|
||||
\details{
|
||||
The function \code{\link[=key_antibiotics]{key_antibiotics()}} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{\link[=key_antibiotics_equal]{key_antibiotics_equal()}}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}). The \code{\link[=first_isolate]{first_isolate()}} function only uses this function on the same microbial species from the same patient. Using this, an MRSA will be included after a susceptible \emph{S. aureus} (MSSA) found within the same episode (see \code{episode} parameter of \code{\link[=first_isolate]{first_isolate()}}). Without key antibiotic comparison it would not.
|
||||
The function \code{\link[=key_antibiotics]{key_antibiotics()}} returns a character vector with 12 antibiotic results for every isolate. These isolates can then be compared using \code{\link[=key_antibiotics_equal]{key_antibiotics_equal()}}, to check if two isolates have generally the same antibiogram. Missing and invalid values are replaced with a dot (\code{"."}) by \code{\link[=key_antibiotics]{key_antibiotics()}} and ignored by \code{\link[=key_antibiotics_equal]{key_antibiotics_equal()}}.
|
||||
|
||||
The \code{\link[=first_isolate]{first_isolate()}} function only uses this function on the same microbial species from the same patient. Using this, e.g. an MRSA will be included after a susceptible \emph{S. aureus} (MSSA) is found within the same patient episode. Without key antibiotic comparison it would not. See \code{\link[=first_isolate]{first_isolate()}} for more info.
|
||||
|
||||
At default, the antibiotics that are used for \strong{Gram-positive bacteria} are:
|
||||
\itemize{
|
||||
|
16
man/like.Rd
16
man/like.Rd
@ -6,7 +6,7 @@
|
||||
\alias{\%like_case\%}
|
||||
\title{Pattern Matching}
|
||||
\source{
|
||||
Idea from the \href{https://github.com/Rdatatable/data.table/blob/master/R/like.R}{\code{like} function from the \code{data.table} package}, but made it case insensitive at default and let it support multiple patterns. Also, if the regex fails the first time, it tries again with \code{perl = TRUE}.
|
||||
Idea from the \href{https://github.com/Rdatatable/data.table/blob/master/R/like.R}{\code{like} function from the \code{data.table} package}
|
||||
}
|
||||
\usage{
|
||||
like(x, pattern, ignore.case = TRUE)
|
||||
@ -29,7 +29,13 @@ A \code{\link{logical}} vector
|
||||
Convenient wrapper around \code{\link[=grep]{grep()}} to match a pattern: \code{x \%like\% pattern}. It always returns a \code{\link{logical}} vector and is always case-insensitive (use \code{x \%like_case\% pattern} for case-sensitive matching). Also, \code{pattern} can be as long as \code{x} to compare items of each index in both vectors, or they both can have the same length to iterate over all cases.
|
||||
}
|
||||
\details{
|
||||
When running a regular expression fails, these functions try again with \code{base::grepl(..., perl = TRUE)}.
|
||||
The \verb{\%like\%} function:
|
||||
\itemize{
|
||||
\item Is case insensitive (use \verb{\%like_case\%} for case-sensitive matching)
|
||||
\item Supports multiple patterns
|
||||
\item Checks if \code{pattern} is a regular expression and sets \code{fixed = TRUE} if not, to greatly improve speed
|
||||
\item Tries again with \code{perl = TRUE} if regex fails
|
||||
}
|
||||
|
||||
Using RStudio? This function can also be inserted from the Addins menu and can have its own Keyboard Shortcut like \code{Ctrl+Shift+L} or \code{Cmd+Shift+L} (see \code{Tools} > \verb{Modify Keyboard Shortcuts...}).
|
||||
}
|
||||
@ -61,11 +67,11 @@ b <- c( "case", "diff", "yet")
|
||||
a \%like\% b
|
||||
#> TRUE TRUE TRUE
|
||||
|
||||
# get frequencies of bacteria whose name start with 'Ent' or 'ent'
|
||||
# get isolates whose name start with 'Ent' or 'ent'
|
||||
library(dplyr)
|
||||
example_isolates \%>\%
|
||||
filter(mo_name(mo) \%like\% "^ent") \%>\%
|
||||
freq(mo_genus(mo))
|
||||
filter(mo_name(mo) \%like\% "^ent") \%>\%
|
||||
freq(mo)
|
||||
}
|
||||
\seealso{
|
||||
\code{\link[base:grep]{base::grep()}}
|
||||
|
@ -17,7 +17,7 @@ pca(
|
||||
\arguments{
|
||||
\item{x}{a \link{data.frame} containing numeric columns}
|
||||
|
||||
\item{...}{columns of \code{x} to be selected for PCA}
|
||||
\item{...}{columns of \code{x} to be selected for PCA, can be unquoted since it supports quasiquotation.}
|
||||
|
||||
\item{retx}{a logical value indicating whether the rotated variables
|
||||
should be returned.}
|
||||
@ -69,6 +69,7 @@ The \link[AMR:lifecycle]{lifecycle} of this function is \strong{maturing}. The u
|
||||
# `example_isolates` is a dataset available in the AMR package.
|
||||
# See ?example_isolates.
|
||||
|
||||
\dontrun{
|
||||
# calculate the resistance per group first
|
||||
library(dplyr)
|
||||
resistance_data <- example_isolates \%>\%
|
||||
@ -85,3 +86,4 @@ summary(pca_result)
|
||||
biplot(pca_result)
|
||||
ggplot_pca(pca_result) # a new and convenient plot function
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ rsi_df(
|
||||
A \code{\link{double}} or, when \code{as_percent = TRUE}, a \code{\link{character}}.
|
||||
}
|
||||
\description{
|
||||
These functions can be used to calculate the (co-)resistance or susceptibility of microbial isolates (i.e. percentage of S, SI, I, IR or R). All functions support quasiquotation with pipes, can be used in \code{summarise()}][dplyr::summarise()] and also support grouped variables, please see \emph{Examples}.
|
||||
These functions can be used to calculate the (co-)resistance or susceptibility of microbial isolates (i.e. percentage of S, SI, I, IR or R). All functions support quasiquotation with pipes, can be used in \code{\link[=summarise]{summarise()}} from the \code{dplyr} package and also supports grouped variables, please see \emph{Examples}.
|
||||
|
||||
\code{\link[=resistance]{resistance()}} should be used to calculate resistance, \code{\link[=susceptibility]{susceptibility()}} should be used to calculate susceptibility.\cr
|
||||
}
|
||||
@ -85,7 +85,7 @@ The function \code{\link[=resistance]{resistance()}} is equal to the function \c
|
||||
|
||||
These functions are not meant to count isolates, but to calculate the proportion of resistance/susceptibility. Use the \code{count()}][AMR::count()] functions to count isolates. The function \code{\link[=susceptibility]{susceptibility()}} is essentially equal to \code{count_susceptible() / count_all()}. \emph{Low counts can influence the outcome - the \code{proportion} functions may camouflage this, since they only return the proportion (albeit being dependent on the \code{minimum} parameter).}
|
||||
|
||||
The function \code{\link[=proportion_df]{proportion_df()}} takes any variable from \code{data} that has an \code{\link{rsi}} class (created with \code{\link[=as.rsi]{as.rsi()}}) and calculates the proportions R, I and S. The function \code{\link[=rsi_df]{rsi_df()}} works exactly like \code{\link[=proportion_df]{proportion_df()}}, but adds the number of isolates.
|
||||
The function \code{\link[=proportion_df]{proportion_df()}} takes any variable from \code{data} that has an \code{\link{rsi}} class (created with \code{\link[=as.rsi]{as.rsi()}}) and calculates the proportions R, I and S. It also supports grouped variables. The function \code{\link[=rsi_df]{rsi_df()}} works exactly like \code{\link[=proportion_df]{proportion_df()}}, but adds the number of isolates.
|
||||
}
|
||||
\section{Combination therapy}{
|
||||
|
||||
@ -160,6 +160,7 @@ proportion_I(example_isolates$AMX)
|
||||
proportion_IR(example_isolates$AMX)
|
||||
proportion_R(example_isolates$AMX)
|
||||
|
||||
\dontrun{
|
||||
library(dplyr)
|
||||
example_isolates \%>\%
|
||||
group_by(hospital_id) \%>\%
|
||||
@ -217,9 +218,6 @@ example_isolates \%>\%
|
||||
group_by(hospital_id) \%>\%
|
||||
proportion_df(translate = FALSE)
|
||||
|
||||
|
||||
\dontrun{
|
||||
|
||||
# calculate current empiric combination therapy of Helicobacter gastritis:
|
||||
my_table \%>\%
|
||||
filter(first_isolate == TRUE,
|
||||
|
@ -134,22 +134,22 @@ x <- resistance_predict(example_isolates,
|
||||
plot(x)
|
||||
ggplot_rsi_predict(x)
|
||||
|
||||
# use dplyr so you can actually read it:
|
||||
library(dplyr)
|
||||
x <- example_isolates \%>\%
|
||||
filter_first_isolate() \%>\%
|
||||
filter(mo_genus(mo) == "Staphylococcus") \%>\%
|
||||
resistance_predict("PEN", model = "binomial")
|
||||
plot(x)
|
||||
|
||||
|
||||
# get the model from the object
|
||||
mymodel <- attributes(x)$model
|
||||
summary(mymodel)
|
||||
# using dplyr:
|
||||
if (!require("dplyr")) {
|
||||
library(dplyr)
|
||||
x <- example_isolates \%>\%
|
||||
filter_first_isolate() \%>\%
|
||||
filter(mo_genus(mo) == "Staphylococcus") \%>\%
|
||||
resistance_predict("PEN", model = "binomial")
|
||||
plot(x)
|
||||
|
||||
# get the model from the object
|
||||
mymodel <- attributes(x)$model
|
||||
summary(mymodel)
|
||||
}
|
||||
|
||||
# create nice plots with ggplot2 yourself
|
||||
if (!require(ggplot2)) {
|
||||
if (!require(ggplot2) & !require("dplyr")) {
|
||||
|
||||
data <- example_isolates \%>\%
|
||||
filter(mo == as.mo("E. coli")) \%>\%
|
||||
|
@ -8,16 +8,16 @@
|
||||
get_locale()
|
||||
}
|
||||
\description{
|
||||
For language-dependent output of AMR functions, like \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_type]{mo_type()}} and \code{\link[=ab_name]{ab_name()}}.
|
||||
For language-dependent output of AMR functions, like \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}} and \code{\link[=ab_name]{ab_name()}}.
|
||||
}
|
||||
\details{
|
||||
Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: \url{https://gitlab.com/msberends/AMR/blob/master/data-raw/translations.tsv}.
|
||||
|
||||
Currently supported languages can be found if running: \code{unique(AMR:::translations_file$lang)}.
|
||||
Currently supported languages are (besides English): Dutch, French, German, Italian, Portuguese, Spanish. Not all these languages currently have translations available for all antimicrobial agents and colloquial microorganism names.
|
||||
|
||||
Please suggest your own translations \href{https://gitlab.com/msberends/AMR/issues/new?issue[title]=Translation\%20suggestion}{by creating a new issue on our repository}.
|
||||
|
||||
This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_property()}} functions (\code{\link[=mo_fullname]{mo_fullname()}}, \code{\link[=mo_type]{mo_type()}}, etc.).
|
||||
This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_property()}} functions (\code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}}, etc.).
|
||||
|
||||
The system language will be used at default, if that language is supported. The system language can be overwritten with \code{Sys.setenv(AMR_locale = yourlanguage)}.
|
||||
}
|
||||
|
Reference in New Issue
Block a user