mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 20:41:58 +02:00
MDRO, freq tables, new print format for tibbles
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/EUCAST.R
|
||||
% Please edit documentation in R/eucast.R
|
||||
\name{EUCAST_rules}
|
||||
\alias{EUCAST_rules}
|
||||
\alias{interpretive_reading}
|
||||
|
39
man/MDRO.Rd
Normal file
39
man/MDRO.Rd
Normal file
@ -0,0 +1,39 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/mdro.R
|
||||
\name{MDRO}
|
||||
\alias{MDRO}
|
||||
\alias{BRMO}
|
||||
\alias{MRGN}
|
||||
\title{Determine multidrug-resistant organisms (MDRO)}
|
||||
\usage{
|
||||
MDRO(tbl, country, col_bactid = "bactid", info = TRUE,
|
||||
aminoglycosides = c("gent", "tobr", "kana"), quinolones = c("cipr",
|
||||
"norf"), carbapenems = c("imip", "mero", "erta"), ceftazidime = "cfta",
|
||||
piperacillin = "pita", trimethoprim_sulfa = "trsu", penicillin = "peni",
|
||||
vancomycin = "vanc")
|
||||
|
||||
BRMO(tbl, country = "nl", ...)
|
||||
|
||||
MRGN(tbl, country = "de", ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{tbl}{table with antibiotic columns, like e.g. \code{amox} and \code{amcl}}
|
||||
|
||||
\item{country}{country to determine guidelines. Should be a code from the \href{https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements}{list of ISO 3166-1 alpha-2 country codes}. Case-insensitive. Currently supported are \code{de} (Germany) and \code{nl} (the Netherlands).}
|
||||
|
||||
\item{col_bactid}{column name of the bacteria ID in \code{tbl} - values of this column should be present in \code{microorganisms$bactid}, see \code{\link{microorganisms}}}
|
||||
|
||||
\item{info}{print progress}
|
||||
|
||||
\item{aminoglycosides, quinolones, carbapenems}{character vector with column names of antibiotics}
|
||||
|
||||
\item{ceftazidime, piperacillin, trimethoprim_sulfa, penicillin, vancomycin}{column names of antibiotics}
|
||||
|
||||
\item{...}{parameters that are passed on to \code{MDR}}
|
||||
}
|
||||
\value{
|
||||
Ordered factor with values \code{Positive}, \code{Unconfirmed}, \code{Negative}.
|
||||
}
|
||||
\description{
|
||||
Determine which isolates are multidrug-resistant organisms (MDRO) according to country-specific guidelines.
|
||||
}
|
71
man/freq.Rd
Normal file
71
man/freq.Rd
Normal file
@ -0,0 +1,71 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/freq.R
|
||||
\name{freq}
|
||||
\alias{freq}
|
||||
\alias{frequency_tbl}
|
||||
\title{Frequency table}
|
||||
\usage{
|
||||
freq(x, sort.count = TRUE, nmax = 15, na.rm = TRUE, markdown = FALSE,
|
||||
toConsole = TRUE, digits = 2, sep = " ")
|
||||
|
||||
frequency_tbl(x, sort.count = TRUE, nmax = 15, na.rm = TRUE,
|
||||
markdown = FALSE, toConsole = TRUE, digits = 2, sep = " ")
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{data}
|
||||
|
||||
\item{sort.count}{Sort on count. Use \code{FALSE} to sort alphabetically on item.}
|
||||
|
||||
\item{nmax}{number of row to print. Use \code{nmax = 0} or \code{nmax = NA} to print all rows.}
|
||||
|
||||
\item{na.rm}{a logical value indicating whether NA values should be removed from the frequency table. The header will always print the amount of\code{NA}s.}
|
||||
|
||||
\item{markdown}{print table in markdown format (this forces \code{nmax = NA})}
|
||||
|
||||
\item{toConsole}{Print table to the console. Use \code{FALSE} to assign the table to an object.}
|
||||
|
||||
\item{digits}{how many significant digits are to be used for numeric values (not for the items themselves, that depends on \code{\link{getOption}("digits")})}
|
||||
|
||||
\item{sep}{a character string to separate the terms when selecting multiple columns}
|
||||
}
|
||||
\description{
|
||||
Create a frequency table of a vector of data, a single column or a maximum of 9 columns of a data frame. Supports markdown for reports.
|
||||
}
|
||||
\details{
|
||||
For numeric values, the next values will be calculated and shown into the header:
|
||||
\itemize{
|
||||
\item{Mean, using \code{\link[base]{mean}}}
|
||||
\item{Standard deviation, using \code{\link[stats]{sd}}}
|
||||
\item{Five numbers of Tukey (min, Q1, median, Q3, max), using \code{\link[stats]{fivenum}}}
|
||||
\item{Outliers (count and list), using \code{\link{boxplot.stats}}}
|
||||
\item{Coefficient of variation (CV), the standard deviation divided by the mean}
|
||||
\item{Coefficient of quartile variation (CQV, sometimes called coefficient of dispersion), calculated as \code{(Q3 - Q1) / (Q3 + Q1)} using \code{\link{quantile}} with \code{type = 6} as quantile algorithm to comply with SPSS standards}
|
||||
}
|
||||
}
|
||||
\examples{
|
||||
library(dplyr)
|
||||
|
||||
freq(septic_patients$hospital_id)
|
||||
|
||||
septic_patients \%>\%
|
||||
filter(hospital_id == "A") \%>\%
|
||||
select(bactid) \%>\%
|
||||
freq()
|
||||
|
||||
# select multiple columns; they will be pasted together
|
||||
septic_patients \%>\%
|
||||
left_join_microorganisms \%>\%
|
||||
filter(hospital_id == "A") \%>\%
|
||||
select(genus, species) \%>\%
|
||||
freq()
|
||||
|
||||
# save frequency table to an object
|
||||
years <- septic_patients \%>\%
|
||||
mutate(year = format(date, "\%Y")) \%>\%
|
||||
select(year) \%>\%
|
||||
freq(toConsole = FALSE)
|
||||
}
|
||||
\keyword{freq}
|
||||
\keyword{frequency}
|
||||
\keyword{summarise}
|
||||
\keyword{summary}
|
40
man/like.Rd
Normal file
40
man/like.Rd
Normal file
@ -0,0 +1,40 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/misc.R
|
||||
\name{like}
|
||||
\alias{like}
|
||||
\alias{\%like\%}
|
||||
\title{Pattern Matching}
|
||||
\source{
|
||||
Inherited 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.
|
||||
}
|
||||
\usage{
|
||||
x \%like\% pattern
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{a character vector where matches are sought, or an
|
||||
object which can be coerced by \code{as.character} to a character
|
||||
vector. \link{Long vectors} are supported.}
|
||||
|
||||
\item{pattern}{character string containing a \link{regular expression}
|
||||
(or character string for \code{fixed = TRUE}) to be matched
|
||||
in the given character vector. Coerced by
|
||||
\code{\link{as.character}} to a character string if possible. If a
|
||||
character vector of length 2 or more is supplied, the first element
|
||||
is used with a warning. Missing values are allowed except for
|
||||
\code{regexpr} and \code{gregexpr}.}
|
||||
}
|
||||
\value{
|
||||
A \code{logical} vector
|
||||
}
|
||||
\description{
|
||||
Convenience function to compare a vector with a pattern, like \code{\link[base]{grep}}. It always returns a \code{logical} vector and is always case-insensitive.
|
||||
}
|
||||
\examples{
|
||||
library(dplyr)
|
||||
# get unique occurences of bacteria whose name start with 'Ent'
|
||||
septic_patients \%>\%
|
||||
left_join_microorganisms() \%>\%
|
||||
filter(fullname \%like\% '^Ent') \%>\%
|
||||
pull(fullname) \%>\%
|
||||
unique()
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/EUCAST.R
|
||||
% Please edit documentation in R/eucast.R
|
||||
\name{mo_property}
|
||||
\alias{mo_property}
|
||||
\title{Poperties of a microorganism}
|
||||
|
55
man/print.Rd
Normal file
55
man/print.Rd
Normal file
@ -0,0 +1,55 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/print.R
|
||||
\name{print}
|
||||
\alias{print}
|
||||
\alias{print.tbl_df}
|
||||
\alias{print.tbl}
|
||||
\alias{print.data.table}
|
||||
\title{Printing Data Tables and Tibbles}
|
||||
\usage{
|
||||
\method{print}{tbl_df}(x, nmax = 10, header = TRUE, row.names = TRUE,
|
||||
right = FALSE, width = 1, na = "<NA>", ...)
|
||||
|
||||
\method{print}{tbl}(x, ...)
|
||||
|
||||
\method{print}{data.table}(x, nmax = 10, header = TRUE, row.names = TRUE,
|
||||
print.keys = FALSE, right = FALSE, width = 1, na = "<NA>", ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{object of class \code{data.frame}.}
|
||||
|
||||
\item{nmax}{amount of rows to print in total. When the total amount of rows exceeds this limit, the first and last \code{nmax / 2} rows will be printed. Use \code{nmax = NA} to print all rows.}
|
||||
|
||||
\item{header}{print header with information about data size and tibble grouping}
|
||||
|
||||
\item{row.names}{logical (or character vector), indicating whether (or
|
||||
what) row names should be printed.}
|
||||
|
||||
\item{right}{logical, indicating whether or not strings should be
|
||||
right-aligned. The default is right-alignment.}
|
||||
|
||||
\item{width}{amount of white spaces to keep between columns, must be at least 1}
|
||||
|
||||
\item{na}{value to print instead of NA}
|
||||
|
||||
\item{...}{optional arguments to \code{print} or \code{plot} methods.}
|
||||
|
||||
\item{print.keys}{print keys for \code{data.table}}
|
||||
}
|
||||
\description{
|
||||
Print a data table or tibble. It prints: \cr- The \strong{first and last rows} like \code{data.table}s are printed by the \code{data.table} package,\cr- A \strong{header} and \strong{left aligned text} like \code{tibble}s are printed by the \code{tibble} package with info about grouped variables,\cr- \strong{Unchanged values} and \strong{support for row names} like \code{data.frame}s are printed by the \code{base} package.
|
||||
}
|
||||
\examples{
|
||||
# still showing all values unchanged:
|
||||
library(dplyr)
|
||||
starwars
|
||||
print(starwars, width = 3)
|
||||
|
||||
# compare the significance notation of this
|
||||
starwars \%>\% select(birth_year)
|
||||
# with this
|
||||
tibble:::print.tbl_df(starwars \%>\% select(birth_year))
|
||||
|
||||
# supports info about groups (look at header)
|
||||
starwars \%>\% group_by(homeworld, gender)
|
||||
}
|
Reference in New Issue
Block a user