1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 06:51:48 +02:00

First CRAN submission edits

This commit is contained in:
2018-02-22 20:48:48 +01:00
parent 77194527b5
commit d8da8daf9a
20 changed files with 162 additions and 94 deletions

View File

@ -44,11 +44,14 @@ interpretive_reading(...)
\item{...}{parameters that are passed on to \code{EUCAST_rules}}
}
\value{
table with edited variables of antibiotics.
}
\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)
tbl <- EUCAST_rules(tbl)
}
}

View File

@ -40,7 +40,6 @@ abname("AMCL", to = "atc")
abname("J01CR02", from = "atc", to = "umcg")
# "AMCL"
}
\keyword{ab}
\keyword{antibiotics}

View File

@ -20,3 +20,15 @@ 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.
}
\examples{
mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
is.mic(mic_data)
plot(mic_data)
\donttest{
library(dplyr)
tbl \%>\%
mutate_at(vars(ends_with("_mic")), as.mic)
sapply(mic_data, is.mic)
}
}

View File

@ -20,6 +20,14 @@ This transforms a vector to a new class \code{rsi}, which is an ordered factor w
}
\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"))
is.rsi(rsi_data)
plot(rsi_data)
\donttest{
library(dplyr)
tbl \%>\%
mutate_at(vars(ends_with("_rsi")), as.rsi)
sapply(mic_data, is.rsi)
}
}

View File

@ -20,7 +20,7 @@ atc_property(atc_code, property, administration = "O",
\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.
Gets data from the WHO to determine properties of an ATC of e.g. an antibiotic. \strong{This function requires an internet connection.}
}
\details{
Abbreviations for the property \code{"Adm.R"} (parameter \code{administration}):
@ -49,3 +49,9 @@ Abbreviations for the property \code{"U"} (unit):
\item{\code{"ml"}}{ = milliliter (e.g. eyedrops)}
}
}
\examples{
\donttest{
atc_property("J01CA04", "DDD", "O") # oral DDD of amoxicillin
atc_property("J01CA04", "DDD", "P") # parenteral DDD of amoxicillin
}
}

View File

@ -57,6 +57,7 @@ To conduct an analysis of antimicrobial resistance, you should only include the
\examples{
\dontrun{
# set key antibiotics to a new variable
tbl$keyab <- key_antibiotics(tbl)
tbl$first_isolate <-

View File

@ -9,7 +9,7 @@
\alias{full_join_bactlist}
\alias{semi_join_bactlist}
\alias{anti_join_bactlist}
\title{Join van tabel en \code{bactlist}}
\title{Join a table with \code{bactlist}}
\usage{
inner_join_bactlist(x, by = "bactid", ...)
@ -36,3 +36,15 @@ Join the list of microorganisms \code{\link{bactlist}} easily to an existing tab
\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.
}
\examples{
df <- data.frame(date = seq(from = as.Date("2018-01-01"),
to = as.Date("2018-01-07"),
by = 1),
bacteria_id = c("STAAUR", "STAAUR", "STAAUR", "STAAUR",
"ESCCOL", "ESCCOL", "ESCCOL"),
stringsAsFactors = FALSE)
colnames(df)
df2 <- left_join_bactlist(df, "bacteria_id")
colnames(df2)
}

View File

@ -20,9 +20,18 @@ key_antibiotics(tbl, col_bactcode = "bacteriecode", info = TRUE,
\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.}
}
\value{
Character of length 1.
}
\description{
Key antibiotics based on bacteria ID
}
\examples{
\donttest{
#' # set key antibiotics to a new variable
tbl$keyab <- key_antibiotics(tbl)
}
}
\seealso{
\code{\link{mo_property}} \code{\link{ablist}}
}

View File

@ -1,24 +0,0 @@
% 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}}
}

View File

@ -24,28 +24,27 @@ rsi(ab1, ab2 = NA, interpretation = "IR", minimum = 30, percent = FALSE,
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.
This function can be used in \code{dplyr}s \code{\link[dplyr]{summarise}}, see \emph{Examples}. Calculate the percentage S, SI, I, IR or R of a vector of isolates.
}
\details{
This function uses the \code{\link{rsi_df}} function internally.
}
\examples{
\dontrun{
tbl \%>\%
group_by(hospital) \%>\%
summarise(cipr = rsi(cipr))
tbl \%>\%
group_by(year, hospital) \%>\%
summarise(
isolates = n(),
cipro = rsi(cipr, percent = TRUE),
amoxi = rsi(amox, percent = TRUE)
)
cipro = rsi(cipr \%>\% as.rsi(), percent = TRUE),
amoxi = rsi(amox \%>\% as.rsi(), percent = TRUE))
rsi(as.rsi(isolates$amox))
tbl \%>\%
group_by(hospital) \%>\%
summarise(cipr = rsi(cipr))
rsi(isolates$amox)
rsi(isolates$amcl, interpretation = "S")
rsi(as.rsi(isolates$amcl), interpretation = "S")
}
}
\keyword{antibiotics}

View File

@ -40,6 +40,7 @@ Create a prediction model to predict antimicrobial resistance for the next years
rsi_predict(tbl[which(first_isolate == TRUE & genus == "Haemophilus"),], "amcl")
# or with dplyr so you can actually read it:
library(dplyr)
tbl \%>\%
filter(first_isolate == TRUE,
genus == "Haemophilus") \%>\%