mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 02:03:04 +02:00
is.rsi.eligible update
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
\describe{
|
||||
\item{\code{Identification number}}{ID of the sample}
|
||||
\item{\code{Specimen number}}{ID of the specimen}
|
||||
\item{\code{Organism}}{Microorganisms, can be coerced with \code{\link{as.mo}}}
|
||||
\item{\code{Organism}}{Name of the microorganism. Before analysis, you should transform this to a valid microbial class, using \code{\link{as.mo}}.}
|
||||
\item{\code{Country}}{Country of origin}
|
||||
\item{\code{Laboratory}}{Name of laboratory}
|
||||
\item{\code{Last name}}{Last name of patient}
|
||||
@ -31,7 +31,7 @@
|
||||
\item{\code{Inducible clindamycin resistance}}{Clindamycin can be induced?}
|
||||
\item{\code{Comment}}{Other comments}
|
||||
\item{\code{Date of data entry}}{Date this data was entered in WHONET}
|
||||
\item{\code{AMP_ND10:CIP_EE}}{27 different antibiotics. You can lookup the abbreviatons in the \code{\link{antibiotics}} data set, or use e.g. \code{\link{atc_name}("AMP")} to get the official name immediately.}
|
||||
\item{\code{AMP_ND10:CIP_EE}}{27 different antibiotics. You can lookup the abbreviatons in the \code{\link{antibiotics}} data set, or use e.g. \code{\link{atc_name}("AMP")} to get the official name immediately. Before analysis, you should transform this to a valid antibiotic class, using \code{\link{as.rsi}}.}
|
||||
}}
|
||||
\usage{
|
||||
WHONET
|
||||
|
@ -10,10 +10,12 @@ as.rsi(x)
|
||||
|
||||
is.rsi(x)
|
||||
|
||||
is.rsi.eligible(x)
|
||||
is.rsi.eligible(x, threshold = 0.05)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{vector}
|
||||
|
||||
\item{threshold}{maximum fraction of \code{x} that is allowed to fail transformation, see Examples}
|
||||
}
|
||||
\value{
|
||||
Ordered factor with new class \code{rsi}
|
||||
@ -47,10 +49,15 @@ library(dplyr)
|
||||
septic_patients \%>\%
|
||||
mutate_at(vars(peni:rifa), as.rsi)
|
||||
|
||||
|
||||
# fastest way to transform all columns with already valid AB results to class `rsi`:
|
||||
septic_patients \%>\%
|
||||
mutate_if(is.rsi.eligible,
|
||||
as.rsi)
|
||||
|
||||
# default threshold of `is.rsi.eligible` is 5\%.
|
||||
is.rsi.eligible(WHONET$`First name`) # fails, >80\% is invalid
|
||||
is.rsi.eligible(WHONET$`First name`, threhold = 0.9) # succeeds
|
||||
}
|
||||
\seealso{
|
||||
\code{\link{as.mic}}
|
||||
|
32
man/availability.Rd
Normal file
32
man/availability.Rd
Normal file
@ -0,0 +1,32 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/availability.R
|
||||
\name{availability}
|
||||
\alias{availability}
|
||||
\title{Check availability of columns}
|
||||
\usage{
|
||||
availability(tbl)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{a \code{data.frame} or \code{list}}
|
||||
}
|
||||
\value{
|
||||
\code{data.frame} with column names of \code{tbl} as row names and columns: \code{percent_IR}, \code{count}, \code{percent}, \code{visual_availability}.
|
||||
}
|
||||
\description{
|
||||
Easy check for availability of columns in a data set. This makes it easy to get an idea of which antibiotic combination can be used for calculation with e.g. \code{\link{portion_IR}}.
|
||||
}
|
||||
\examples{
|
||||
availability(septic_patients)
|
||||
|
||||
library(dplyr)
|
||||
septic_patients \%>\% availability()
|
||||
|
||||
septic_patients \%>\%
|
||||
select_if(is.rsi) \%>\%
|
||||
availability()
|
||||
|
||||
septic_patients \%>\%
|
||||
filter(mo == as.mo("E. coli")) \%>\%
|
||||
select_if(is.rsi) \%>\%
|
||||
availability()
|
||||
}
|
Reference in New Issue
Block a user