mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 04:02:19 +02:00
first commit
This commit is contained in:
54
man/EUCAST.Rd
Normal file
54
man/EUCAST.Rd
Normal file
@ -0,0 +1,54 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/EUCAST.R
|
||||
\name{EUCAST}
|
||||
\alias{EUCAST}
|
||||
\alias{EUCAST_rules}
|
||||
\alias{interpretive_reading}
|
||||
\title{EUCAST expert rules}
|
||||
\source{
|
||||
EUCAST Expert Rules Version 2.0: \cr
|
||||
Leclercq et al. \strong{EUCAST expert rules in antimicrobial susceptibility testing.} \emph{Clin Microbiol Infect.} 2013;19(2):141-60. \cr
|
||||
\url{https://doi.org/10.1111/j.1469-0691.2011.03703.x} \cr
|
||||
\cr
|
||||
EUCAST Expert Rules Version 3.1: \cr
|
||||
\url{http://www.eucast.org/expert_rules_and_intrinsic_resistance}
|
||||
}
|
||||
\usage{
|
||||
EUCAST_rules(tbl, col_bactcode = "bacteriecode", info = TRUE,
|
||||
amcl = "amcl", amik = "amik", amox = "amox", ampi = "ampi",
|
||||
azit = "azit", aztr = "aztr", cefa = "cefa", cfra = "cfra",
|
||||
cfep = "cfep", cfot = "cfot", cfox = "cfox", cfta = "cfta",
|
||||
cftr = "cftr", cfur = "cfur", chlo = "chlo", cipr = "cipr",
|
||||
clar = "clar", clin = "clin", clox = "clox", coli = "coli",
|
||||
czol = "czol", dapt = "dapt", doxy = "doxy", erta = "erta",
|
||||
eryt = "eryt", fosf = "fosf", fusi = "fusi", gent = "gent",
|
||||
imip = "imip", kana = "kana", levo = "levo", linc = "linc",
|
||||
line = "line", mero = "mero", mino = "mino", moxi = "moxi",
|
||||
nali = "nali", neom = "neom", neti = "neti", nitr = "nitr",
|
||||
novo = "novo", norf = "norf", oflo = "oflo", peni = "peni",
|
||||
pita = "pita", poly = "poly", qida = "qida", rifa = "rifa",
|
||||
roxi = "roxi", siso = "siso", teic = "teic", tetr = "tetr",
|
||||
tica = "tica", tige = "tige", tobr = "tobr", trim = "trim",
|
||||
trsu = "trsu", vanc = "vanc")
|
||||
|
||||
interpretive_reading(...)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{table with antibiotic columns, like e.g. \code{amox} and \code{amcl}}
|
||||
|
||||
\item{col_bactcode}{column name of the bacteria ID in \code{tbl} - should also be present in \code{bactlist$bactid}, see \code{\link{bactlist}}.}
|
||||
|
||||
\item{info}{print progress}
|
||||
|
||||
\item{amcl, amik, amox, ampi, azit, aztr, cefa, cfra, cfep, cfot, cfox, cfta, cftr, cfur, chlo, cipr, clar, clin, clox, coli, czol, dapt, doxy, erta, eryt, fosf, fusi, gent, imip, kana, levo, linc, line, mero, mino, moxi, nali, neom, neti, nitr, novo, norf, oflo, peni, pita, poly, qida, rifa, roxi, siso, teic, tetr, tica, tige, tobr, trim, trsu, vanc}{column names of antibiotics. Use \code{NA} to skip a column, like \code{tica = NA}. Non-existing column will be skipped.}
|
||||
|
||||
\item{...}{parameters that are passed on to \code{EUCAST_rules}}
|
||||
}
|
||||
\description{
|
||||
Apply expert rules (like intrinsic resistance), as defined by the European Committee on Antimicrobial Susceptibility Testing (EUCAST, \url{http://eucast.org}), see \emph{Source}.
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
tbl <- interpretive_reading(tbl)
|
||||
}
|
||||
}
|
34
man/ablist.Rd
Normal file
34
man/ablist.Rd
Normal file
@ -0,0 +1,34 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/data.R
|
||||
\docType{data}
|
||||
\name{ablist}
|
||||
\alias{ablist}
|
||||
\title{Dataset with 420 antibiotics}
|
||||
\format{A data.frame with 420 observations and 12 variables:
|
||||
\describe{
|
||||
\item{\code{atc}}{ATC code, like \code{J01CR02}}
|
||||
\item{\code{molis}}{MOLIS code, like \code{amcl}}
|
||||
\item{\code{umcg}}{UMCG code, like \code{AMCL}}
|
||||
\item{\code{official}}{Official name by the WHO, like \code{"amoxicillin and enzyme inhibitor"}}
|
||||
\item{\code{official_nl}}{Official name in the Netherlands, like \code{"Amoxicilline met enzymremmer"}}
|
||||
\item{\code{trivial}}{Trivial name in Dutch, like \code{"Amoxicilline/clavulaanzuur"}}
|
||||
\item{\code{oral_ddd}}{Daily Defined Dose (DDD) according to the WHO, oral treatment}
|
||||
\item{\code{oral_units}}{Units of \code{ddd_units}}
|
||||
\item{\code{iv_ddd}}{Daily Defined Dose (DDD) according to the WHO, bij parenteral treatment}
|
||||
\item{\code{iv_units}}{Units of \code{iv_ddd}}
|
||||
\item{\code{atc_group1}}{ATC group in Dutch, like \code{"Macroliden, lincosamiden en streptograminen"}}
|
||||
\item{\code{atc_group2}}{Subgroup of \code{atc_group1} in Dutch, like \code{"Macroliden"}}
|
||||
}}
|
||||
\source{
|
||||
MOLIS (LIS of Certe) - \url{https://www.certe.nl} \cr \cr GLIMS (LIS of UMCG) - \url{https://www.umcg.nl} \cr \cr World Health Organization - \url{https://www.whocc.no/atc_ddd_index/}
|
||||
}
|
||||
\usage{
|
||||
ablist
|
||||
}
|
||||
\description{
|
||||
A dataset containing all antibiotics with a J0 code, with their DDD's.
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{bactlist}}
|
||||
}
|
||||
\keyword{datasets}
|
22
man/as.mic.Rd
Normal file
22
man/as.mic.Rd
Normal file
@ -0,0 +1,22 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/classes.R
|
||||
\name{as.mic}
|
||||
\alias{as.mic}
|
||||
\alias{is.mic}
|
||||
\title{Class 'mic'}
|
||||
\usage{
|
||||
as.mic(x, na.rm = FALSE)
|
||||
|
||||
is.mic(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{vector}
|
||||
|
||||
\item{na.rm}{a logical indicating whether missing values should be removed}
|
||||
}
|
||||
\value{
|
||||
New class \code{mic}
|
||||
}
|
||||
\description{
|
||||
This transforms a vector to a new class\code{mic}, which is an ordered factor valid MIC values as levels. Invalid MIC values will be translated as \code{NA} with a warning.
|
||||
}
|
25
man/as.rsi.Rd
Normal file
25
man/as.rsi.Rd
Normal file
@ -0,0 +1,25 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/classes.R
|
||||
\name{as.rsi}
|
||||
\alias{as.rsi}
|
||||
\alias{is.rsi}
|
||||
\title{Class 'rsi'}
|
||||
\usage{
|
||||
as.rsi(x)
|
||||
|
||||
is.rsi(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{vector}
|
||||
}
|
||||
\value{
|
||||
New class \code{rsi}
|
||||
}
|
||||
\description{
|
||||
This transforms a vector to a new class \code{rsi}, which is an ordered factor with levels \code{S < I < R}. Invalid antimicrobial interpretations will be translated as \code{NA} with a warning.
|
||||
}
|
||||
\examples{
|
||||
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||
|
||||
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370), "A", "B", "C"))
|
||||
}
|
51
man/atc_property.Rd
Normal file
51
man/atc_property.Rd
Normal file
@ -0,0 +1,51 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/atc.R
|
||||
\name{atc_property}
|
||||
\alias{atc_property}
|
||||
\title{Properties of an ATC code}
|
||||
\source{
|
||||
\url{https://www.whocc.no/atc_ddd_alterations__cumulative/ddd_alterations/abbrevations/}
|
||||
}
|
||||
\usage{
|
||||
atc_property(atc_code, property, administration = "O",
|
||||
url = "https://www.whocc.no/atc_ddd_index/?code=\%s&showdescription=no")
|
||||
}
|
||||
\arguments{
|
||||
\item{atc_code}{a character or character vector with ATC code(s) of antibiotic(s)}
|
||||
|
||||
\item{property}{property of an ATC code. Valid values are \code{"ATC code"}, \code{"Name"}, \code{"DDD"}, \code{"U"} (\code{"unit"}), \code{"Adm.R"} en \code{"Note"}.}
|
||||
|
||||
\item{administration}{type of administration, see \emph{Details}}
|
||||
|
||||
\item{url}{url of website of the WHO. The sign \code{\%s} can be used as a placeholder for ATC codes.}
|
||||
}
|
||||
\description{
|
||||
Gets data from the WHO to determine properties of an ATC of e.g. an antibiotic.
|
||||
}
|
||||
\details{
|
||||
Abbreviations for the property \code{"Adm.R"} (parameter \code{administration}):
|
||||
\itemize{
|
||||
\item{\code{"Implant"}}{ = Implant}
|
||||
\item{\code{"Inhal"}}{ = Inhalation}
|
||||
\item{\code{"Instill"}}{ = Instillation}
|
||||
\item{\code{"N"}}{ = nasal}
|
||||
\item{\code{"O"}}{ = oral}
|
||||
\item{\code{"P"}}{ = parenteral}
|
||||
\item{\code{"R"}}{ = rectal}
|
||||
\item{\code{"SL"}}{ = sublingual/buccal}
|
||||
\item{\code{"TD"}}{ = transdermal}
|
||||
\item{\code{"V"}}{ = vaginal}
|
||||
}
|
||||
|
||||
Abbreviations for the property \code{"U"} (unit):
|
||||
\itemize{
|
||||
\item{\code{"g"}}{ = gram}
|
||||
\item{\code{"mg"}}{ = milligram}
|
||||
\item{\code{"mcg"}}{ = microgram}
|
||||
\item{\code{"U"}}{ = unit}
|
||||
\item{\code{"TU"}}{ = thousand units}
|
||||
\item{\code{"MU"}}{ = million units}
|
||||
\item{\code{"mmol"}}{ = millimole}
|
||||
\item{\code{"ml"}}{ = milliliter (e.g. eyedrops)}
|
||||
}
|
||||
}
|
32
man/bactlist.Rd
Normal file
32
man/bactlist.Rd
Normal file
@ -0,0 +1,32 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/data.R
|
||||
\docType{data}
|
||||
\name{bactlist}
|
||||
\alias{bactlist}
|
||||
\title{Dataset with ~2500 microorganisms}
|
||||
\format{A data.frame with 2507 observations and 10 variables:
|
||||
\describe{
|
||||
\item{\code{bactid}}{ID of microorganism}
|
||||
\item{\code{bactsys}}{Bactsyscode of microorganism}
|
||||
\item{\code{family}}{Family name of microorganism}
|
||||
\item{\code{genus}}{Genus name of microorganism, like \code{"Echerichia"}}
|
||||
\item{\code{species}}{Species name of microorganism, like \code{"coli"}}
|
||||
\item{\code{subspecies}}{Subspecies name of bio-/serovar of microorganism, like \code{"EHEC"}}
|
||||
\item{\code{fullname}}{Full name, like \code{"Echerichia coli (EHEC)"}}
|
||||
\item{\code{type}}{Type of microorganism, like \code{"Bacterie"} en \code{"Schimmel/gist"} (these are Dutch)}
|
||||
\item{\code{gramstain}}{Gram of microorganism in Dutch, like \code{"Negatieve staven"}}
|
||||
\item{\code{aerobic}}{Type aerobe/anaerobe of bacteria}
|
||||
}}
|
||||
\source{
|
||||
MOLIS (LIS of Certe) - \url{https://www.certe.nl}
|
||||
}
|
||||
\usage{
|
||||
bactlist
|
||||
}
|
||||
\description{
|
||||
A dataset containing all microorganisms of MOLIS. MO codes of the UMCG can be looked up using \code{\link{bactlist.umcg}}.
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{ablist}} \code{\link{bactlist.umcg}}
|
||||
}
|
||||
\keyword{datasets}
|
24
man/bactlist.umcg.Rd
Normal file
24
man/bactlist.umcg.Rd
Normal file
@ -0,0 +1,24 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/data.R
|
||||
\docType{data}
|
||||
\name{bactlist.umcg}
|
||||
\alias{bactlist.umcg}
|
||||
\title{Translation table for UMCG with ~1100 microorganisms}
|
||||
\format{A data.frame with 1090 observations and 2 variables:
|
||||
\describe{
|
||||
\item{\code{mocode}}{Code of microorganism according to UMCG MMB}
|
||||
\item{\code{bactid}}{Code of microorganism in \code{\link{bactlist}}}
|
||||
}}
|
||||
\source{
|
||||
MOLIS (LIS of Certe) - \url{https://www.certe.nl} \cr \cr GLIMS (LIS of UMCG) - \url{https://www.umcg.nl}
|
||||
}
|
||||
\usage{
|
||||
bactlist.umcg
|
||||
}
|
||||
\description{
|
||||
A dataset containing all bacteria codes of UMCG MMB. These codes can be joined to data with an ID from \code{\link{bactlist}$bactid}, using \code{\link{left_join_bactlist}}.
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{bactlist}}
|
||||
}
|
||||
\keyword{datasets}
|
BIN
man/figures/rsi_example.png
Normal file
BIN
man/figures/rsi_example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
99
man/first_isolate.Rd
Normal file
99
man/first_isolate.Rd
Normal file
@ -0,0 +1,99 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/first_isolates.R
|
||||
\name{first_isolate}
|
||||
\alias{first_isolate}
|
||||
\title{Determine first (weighted) isolates}
|
||||
\usage{
|
||||
first_isolate(tbl, col_date, col_patid, col_genus, col_species,
|
||||
col_testcode = NA, col_specimen, col_icu, col_keyantibiotics = NA,
|
||||
episode_days = 365, testcodes_exclude = "", icu_exclude = FALSE,
|
||||
filter_specimen = NA, output_logical = TRUE, ignore_I = TRUE,
|
||||
info = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{a \code{data.frame} containing isolates.}
|
||||
|
||||
\item{col_date}{column name of the result date (or date that is was received on the lab)}
|
||||
|
||||
\item{col_patid}{column name of the unique IDs of the patients}
|
||||
|
||||
\item{col_genus}{column name of the genus of the microorganisms}
|
||||
|
||||
\item{col_species}{column name of the species of the microorganisms}
|
||||
|
||||
\item{col_testcode}{column name of the test codes, see Details}
|
||||
|
||||
\item{col_specimen}{column name of the specimen type or group}
|
||||
|
||||
\item{col_icu}{column name of the logicals (\code{TRUE}/\code{FALSE}) whether a ward or department is an Intensive Care Unit (ICU)}
|
||||
|
||||
\item{col_keyantibiotics}{column name of the key antibiotics to determine first \emph{weighted} isolates, see \code{\link{key_antibiotics}}.}
|
||||
|
||||
\item{episode_days}{episode in days after which a genus/species combination will be determined as 'first isolate' again}
|
||||
|
||||
\item{testcodes_exclude}{character vector with test codes that should be excluded (caseINsensitive)}
|
||||
|
||||
\item{icu_exclude}{logical whether ICU isolates should be excluded}
|
||||
|
||||
\item{filter_specimen}{specimen group or type that should be excluded}
|
||||
|
||||
\item{output_logical}{return output as \code{logical} (will else the values \code{0} or \code{1})}
|
||||
|
||||
\item{ignore_I}{ignore \code{"I"} as antimicrobial interpretation of key antibiotics (with \code{FALSE}, changes in antibiograms from S to I and I to R will be interpreted as difference)}
|
||||
|
||||
\item{info}{print progress}
|
||||
}
|
||||
\value{
|
||||
A vector to add to table, see Examples.
|
||||
}
|
||||
\description{
|
||||
Determine first (weighted) isolates of all microorganisms of every patient per episode and (if needed) per specimen type.
|
||||
}
|
||||
\details{
|
||||
To conduct an analysis of antimicrobial resistance, you should only include the first isolate of every patient per episode. If you would not do this, you could easily get an overestimate or underestimate of the resistance of an antibiotic. Imagine that a patient was admitted with an MRSA and that is was found in 5 different blood cultures the following week. The resistance percentage of oxacillin of all \emph{S. aureus} isolates would be overestimated, because you included this MRSA more than once. It would be selection bias.
|
||||
|
||||
Use \code{col_testcode = NA} to \strong{not} exclude certain test codes (like test codes for screening). In that case \code{testcodes_exclude} will be ignored.
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
|
||||
tbl$keyab <- key_antibiotics(tbl)
|
||||
|
||||
tbl$first_isolate <-
|
||||
first_isolate(tbl)
|
||||
|
||||
tbl$first_isolate_weighed <-
|
||||
first_isolate(tbl,
|
||||
col_keyantibiotics = 'keyab')
|
||||
|
||||
tbl$first_blood_isolate <-
|
||||
first_isolate(tbl,
|
||||
filter_specimen = 'Blood')
|
||||
|
||||
tbl$first_blood_isolate_weighed <-
|
||||
first_isolate(tbl,
|
||||
filter_specimen = 'Blood',
|
||||
col_keyantibiotics = 'keyab')
|
||||
|
||||
tbl$first_urine_isolate <-
|
||||
first_isolate(tbl,
|
||||
filter_specimen = 'Urine')
|
||||
|
||||
tbl$first_urine_isolate_weighed <-
|
||||
first_isolate(tbl,
|
||||
filter_specimen = 'Urine',
|
||||
col_keyantibiotics = 'keyab')
|
||||
|
||||
tbl$first_resp_isolate <-
|
||||
first_isolate(tbl,
|
||||
filter_specimen = 'Respiratory')
|
||||
|
||||
tbl$first_resp_isolate_weighed <-
|
||||
first_isolate(tbl,
|
||||
filter_specimen = 'Respiratory',
|
||||
col_keyantibiotics = 'keyab')
|
||||
}
|
||||
}
|
||||
\keyword{first}
|
||||
\keyword{isolate}
|
||||
\keyword{isolates}
|
38
man/join.Rd
Normal file
38
man/join.Rd
Normal file
@ -0,0 +1,38 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/join.R
|
||||
\name{join}
|
||||
\alias{join}
|
||||
\alias{inner_join_bactlist}
|
||||
\alias{inner_join}
|
||||
\alias{left_join_bactlist}
|
||||
\alias{right_join_bactlist}
|
||||
\alias{full_join_bactlist}
|
||||
\alias{semi_join_bactlist}
|
||||
\alias{anti_join_bactlist}
|
||||
\title{Join van tabel en \code{bactlist}}
|
||||
\usage{
|
||||
inner_join_bactlist(x, by = "bactid", ...)
|
||||
|
||||
left_join_bactlist(x, by = "bacteriecode", ...)
|
||||
|
||||
right_join_bactlist(x, by = "bacteriecode", ...)
|
||||
|
||||
full_join_bactlist(x, by = "bacteriecode", ...)
|
||||
|
||||
semi_join_bactlist(x, by = "bacteriecode", ...)
|
||||
|
||||
anti_join_bactlist(x, by = "bacteriecode", ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{existing table to join}
|
||||
|
||||
\item{by}{a variable to join by - could be a column name of \code{x} with values that exist in \code{bactlist$bactid} (like \code{by = "bacteria_id"}), or another column in \code{\link{bactlist}} (but then it should be named, like \code{by = c("my_genus_species" = "fullname")})}
|
||||
|
||||
\item{...}{other parameters to pass trhough to \code{dplyr::\link[dplyr]{join}}.}
|
||||
}
|
||||
\description{
|
||||
Join the list of microorganisms \code{\link{bactlist}} easily to an existing table.
|
||||
}
|
||||
\details{
|
||||
As opposed to the \code{\link[dplyr]{join}} functions of \code{dplyr}, 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}} for more information.
|
||||
}
|
28
man/key_antibiotics.Rd
Normal file
28
man/key_antibiotics.Rd
Normal file
@ -0,0 +1,28 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/first_isolates.R
|
||||
\name{key_antibiotics}
|
||||
\alias{key_antibiotics}
|
||||
\title{Key antibiotics based on bacteria ID}
|
||||
\usage{
|
||||
key_antibiotics(tbl, col_bactcode = "bacteriecode", info = TRUE,
|
||||
amcl = "amcl", amox = "amox", cfot = "cfot", cfta = "cfta",
|
||||
cftr = "cftr", cfur = "cfur", cipr = "cipr", clar = "clar",
|
||||
clin = "clin", clox = "clox", doxy = "doxy", gent = "gent",
|
||||
line = "line", mero = "mero", peni = "peni", pita = "pita",
|
||||
rifa = "rifa", teic = "teic", trsu = "trsu", vanc = "vanc")
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{table with antibiotics coloms, like \code{amox} and \code{amcl}.}
|
||||
|
||||
\item{col_bactcode}{column of bacteria IDs in \code{tbl}; these should occur in \code{bactlist$bactid}, see \code{\link{bactlist}}}
|
||||
|
||||
\item{info}{print warnings}
|
||||
|
||||
\item{amcl, amox, cfot, cfta, cftr, cfur, cipr, clar, clin, clox, doxy, gent, line, mero, peni, pita, rifa, teic, trsu, vanc}{column names of antibiotics.}
|
||||
}
|
||||
\description{
|
||||
Key antibiotics based on bacteria ID
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{mo_property}} \code{\link{ablist}}
|
||||
}
|
24
man/key_antibiotics_equal.Rd
Normal file
24
man/key_antibiotics_equal.Rd
Normal file
@ -0,0 +1,24 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/first_isolates.R
|
||||
\name{key_antibiotics_equal}
|
||||
\alias{key_antibiotics_equal}
|
||||
\title{Compare key antibiotics}
|
||||
\usage{
|
||||
key_antibiotics_equal(x, y, ignore_I = TRUE, info = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{x, y}{tekst (or multiple text vectors) with antimicrobial interpretations}
|
||||
|
||||
\item{ignore_I}{ignore \code{"I"} as antimicrobial interpretation of key antibiotics (with \code{FALSE}, changes in antibiograms from S to I and I to R will be interpreted as difference)}
|
||||
|
||||
\item{info}{print progress}
|
||||
}
|
||||
\value{
|
||||
logical
|
||||
}
|
||||
\description{
|
||||
Check whether two text values with key antibiotics match. Supports vectors.
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{key_antibiotics}}
|
||||
}
|
19
man/mo_property.Rd
Normal file
19
man/mo_property.Rd
Normal file
@ -0,0 +1,19 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/EUCAST.R
|
||||
\name{mo_property}
|
||||
\alias{mo_property}
|
||||
\title{Poperties of a microorganism}
|
||||
\usage{
|
||||
mo_property(bactcode, property = "fullname")
|
||||
}
|
||||
\arguments{
|
||||
\item{bactcode}{ID of a microorganisme, like \code{"STAAUR} and \code{"ESCCOL}}
|
||||
|
||||
\item{property}{One of the values \code{bactid}, \code{bactsys}, \code{family}, \code{genus}, \code{species}, \code{subspecies}, \code{fullname}, \code{type}, \code{gramstain}, \code{aerobic}}
|
||||
}
|
||||
\description{
|
||||
Poperties of a microorganism
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{bactlist}}
|
||||
}
|
54
man/rsi.Rd
Normal file
54
man/rsi.Rd
Normal file
@ -0,0 +1,54 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/rsi_analysis.R
|
||||
\name{rsi}
|
||||
\alias{rsi}
|
||||
\title{Resistance of isolates}
|
||||
\usage{
|
||||
rsi(ab1, ab2 = NA, interpretation = "IR", minimum = 30, percent = FALSE,
|
||||
info = FALSE, warning = FALSE)
|
||||
}
|
||||
\arguments{
|
||||
\item{ab1, ab2}{list with interpretations of an antibiotic}
|
||||
|
||||
\item{interpretation}{antimicrobial interpretation of which the portion must be calculated. Valid values are \code{"S"}, \code{"SI"}, \code{"I"}, \code{"IR"} or \code{"R"}.}
|
||||
|
||||
\item{minimum}{minimal amount of available isolates. Any number lower than \code{minimum} will return \code{NA} with a warning (when \code{warning = TRUE}).}
|
||||
|
||||
\item{percent}{return output as percent (text), will else (at default) be a double}
|
||||
|
||||
\item{info}{calculate the amount of available isolates and print it, like \code{n = 423}}
|
||||
|
||||
\item{warning}{show a warning when the available amount of isolates is below \code{minimum}}
|
||||
}
|
||||
\value{
|
||||
Double or, when \code{percent = TRUE}, a character.
|
||||
}
|
||||
\description{
|
||||
This function can be used in \code{\link[dplyr]{summarise}}, see \emph{Examples}. CaBerekent het percentage S, SI, I, IR of R van een lijst isolaten.
|
||||
}
|
||||
\details{
|
||||
This function uses the \code{\link{rsi_df}} function internally.
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
tbl \%>\%
|
||||
group_by(year, hospital) \%>\%
|
||||
summarise(
|
||||
isolates = n(),
|
||||
cipro = rsi(cipr, percent = TRUE),
|
||||
amoxi = rsi(amox, percent = TRUE)
|
||||
)
|
||||
|
||||
tbl \%>\%
|
||||
group_by(hospital) \%>\%
|
||||
summarise(cipr = rsi(cipr))
|
||||
|
||||
rsi(isolates$amox)
|
||||
|
||||
rsi(isolates$amcl, interpretation = "S")
|
||||
}
|
||||
}
|
||||
\keyword{antibiotics}
|
||||
\keyword{isolate}
|
||||
\keyword{isolates}
|
||||
\keyword{rsi}
|
54
man/rsi_df.Rd
Normal file
54
man/rsi_df.Rd
Normal file
@ -0,0 +1,54 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/rsi_analysis.R
|
||||
\name{rsi_df}
|
||||
\alias{rsi_df}
|
||||
\title{Resistance of isolates in data.frame}
|
||||
\usage{
|
||||
rsi_df(tbl, antibiotics, interpretation = "IR", minimum = 30,
|
||||
percent = FALSE, info = TRUE, warning = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{\code{data.frame} containing columns with antibiotic interpretations.}
|
||||
|
||||
\item{antibiotics}{character vector with 1, 2 or 3 antibiotics that occur as column names in \code{tbl}, like \code{antibiotics = c("amox", "amcl")}}
|
||||
|
||||
\item{interpretation}{antimicrobial interpretation of which the portion must be calculated. Valid values are \code{"S"}, \code{"SI"}, \code{"I"}, \code{"IR"} or \code{"R"}.}
|
||||
|
||||
\item{minimum}{minimal amount of available isolates. Any number lower than \code{minimum} will return \code{NA} with a warning (when \code{warning = TRUE}).}
|
||||
|
||||
\item{percent}{return output as percent (text), will else (at default) be a double}
|
||||
|
||||
\item{info}{calculate the amount of available isolates and print it, like \code{n = 423}}
|
||||
|
||||
\item{warning}{show a warning when the available amount of isolates is below \code{minimum}}
|
||||
}
|
||||
\value{
|
||||
Double or, when \code{percent = TRUE}, a character.
|
||||
}
|
||||
\description{
|
||||
\strong{NOTE: use \code{\link{rsi}} in dplyr functions like \code{\link[dplyr]{summarise}}.} \cr Calculate the percentage of S, SI, I, IR or R of a \code{data.frame} containing isolates.
|
||||
}
|
||||
\details{
|
||||
Remember that you should filter your table to let it contain \strong{only first isolates}!
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
rsi_df(tbl_with_bloodcultures, 'amcl')
|
||||
|
||||
rsi_df(tbl_with_bloodcultures, c('amcl', 'gent'), interpretation = 'IR')
|
||||
|
||||
library(dplyr)
|
||||
# calculate current empiric therapy of Helicobacter gastritis:
|
||||
my_table \%>\%
|
||||
filter(first_isolate == TRUE,
|
||||
genus == "Helicobacter") \%>\%
|
||||
rsi_df(antibiotics = c("amox", "metr"))
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{rsi}} for the function that can be used with \code{\link[dplyr]{summarise}} directly.
|
||||
}
|
||||
\keyword{antibiotics}
|
||||
\keyword{isolate}
|
||||
\keyword{isolates}
|
||||
\keyword{rsi}
|
59
man/rsi_predict.Rd
Normal file
59
man/rsi_predict.Rd
Normal file
@ -0,0 +1,59 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/rsi_analysis.R
|
||||
\name{rsi_predict}
|
||||
\alias{rsi_predict}
|
||||
\title{Predict antimicrobial resistance}
|
||||
\usage{
|
||||
rsi_predict(tbl, col_ab, col_date = "ontvangstdatum",
|
||||
year_max = as.integer(format(as.Date(Sys.Date()), "\%Y")) + 15,
|
||||
year_every = 1, model = "binomial", I_as_R = TRUE,
|
||||
preserve_measurements = TRUE, info = TRUE)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{table that contains columns \code{col_ab} and \code{col_date}}
|
||||
|
||||
\item{col_ab}{column name of \code{tbl} with antimicrobial interpretations (\code{R}, \code{I} and \code{S})}
|
||||
|
||||
\item{col_date}{column name of the date, will be used to calculate years}
|
||||
|
||||
\item{year_max}{highest year to use in the prediction model, deafults to 15 years after today}
|
||||
|
||||
\item{year_every}{unit of sequence between lowest year found in the data and \code{year_max}}
|
||||
|
||||
\item{model}{the statistical model of choice. Valid values are \code{"binomial"} (or \code{"binom"} or \code{"logit"}) or \code{"loglin"} or \code{"linear"} (or \code{"lin"}).}
|
||||
|
||||
\item{I_as_R}{treat \code{I} as \code{R}}
|
||||
|
||||
\item{preserve_measurements}{overwrite predictions of years that are actually available in the data, with the original data. The standard errors of those years will be \code{NA}.}
|
||||
|
||||
\item{info}{print textual analysis with the name and \code{\link{summary}} of the model.}
|
||||
}
|
||||
\value{
|
||||
\code{data.frame} with columns \code{year}, \code{probR}, \code{se_min} and \code{se_max}.
|
||||
}
|
||||
\description{
|
||||
Create a prediction model to predict antimicrobial resistance for the next years on statistical solid ground. Standard errors (SE) will be returned as columns \code{se_min} and \code{se_max}.
|
||||
}
|
||||
\examples{
|
||||
\dontrun{
|
||||
# use it directly:
|
||||
rsi_predict(tbl[which(first_isolate == TRUE & genus == "Haemophilus"),], "amcl")
|
||||
|
||||
# or with dplyr so you can actually read it:
|
||||
tbl \%>\%
|
||||
filter(first_isolate == TRUE,
|
||||
genus == "Haemophilus") \%>\%
|
||||
rsi_predict("amcl")
|
||||
|
||||
tbl \%>\%
|
||||
filter(first_isolate_weighted == TRUE,
|
||||
genus == "Haemophilus") \%>\%
|
||||
rsi_predict(col_ab = "amcl",
|
||||
year_max = 2050,
|
||||
year_every = 5)
|
||||
|
||||
}
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{lm}} \cr \code{\link{glm}}
|
||||
}
|
Reference in New Issue
Block a user