1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-27 10:06:12 +01:00
AMR/man/as.rsi.Rd

32 lines
874 B
Plaintext
Raw Normal View History

2018-02-21 11:52:31 +01:00
% 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{
2018-04-25 15:33:58 +02:00
Ordered factor with new class \code{rsi} and new attributes \code{package} and \code{package.version}
2018-02-21 11:52:31 +01:00
}
\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"))
2018-02-22 20:48:48 +01:00
is.rsi(rsi_data)
2018-03-14 09:58:58 +01:00
2018-06-19 10:05:38 +02:00
# this can also coerce combined MIC/RSI values:
as.rsi("<= 0.002; R") # will return R
2018-03-13 15:40:10 +01:00
plot(rsi_data) # for percentages
barplot(rsi_data) # for frequencies
2018-02-21 11:52:31 +01:00
}