mirror of
https://github.com/msberends/AMR.git
synced 2025-07-10 00:23:03 +02:00
(v1.4.0.9001) is_gram_positive(), is_gram_negative(), parameter hardening
This commit is contained in:
24
man/AMR-deprecated.Rd
Normal file
24
man/AMR-deprecated.Rd
Normal file
@ -0,0 +1,24 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/deprecated.R
|
||||
\name{AMR-deprecated}
|
||||
\alias{AMR-deprecated}
|
||||
\alias{p_symbol}
|
||||
\title{Deprecated functions}
|
||||
\usage{
|
||||
p_symbol(p, emptychar = " ")
|
||||
}
|
||||
\description{
|
||||
These functions are so-called '\link{Deprecated}'. They will be removed in a future release. Using the functions will give a warning with the name of the function it has been replaced by (if there is one).
|
||||
}
|
||||
\section{Retired lifecycle}{
|
||||
|
||||
\if{html}{\figure{lifecycle_retired.svg}{options: style=margin-bottom:5px} \cr}
|
||||
The \link[=lifecycle]{lifecycle} of this function is \strong{retired}. A retired function is no longer under active development, and (if appropiate) a better alternative is available. No new arguments will be added, and only the most critical bugs will be fixed. In a future version, this function will be removed.
|
||||
}
|
||||
|
||||
\section{Read more on our website!}{
|
||||
|
||||
On our website \url{https://msberends.github.io/AMR/} you can find \href{https://msberends.github.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.github.io/AMR/reference/}{complete documentation of all functions} and \href{https://msberends.github.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}. As we would like to better understand the backgrounds and needs of our users, please \href{https://msberends.github.io/AMR/survey.html}{participate in our survey}!
|
||||
}
|
||||
|
||||
\keyword{internal}
|
@ -4,16 +4,18 @@
|
||||
\alias{age}
|
||||
\title{Age in years of individuals}
|
||||
\usage{
|
||||
age(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE)
|
||||
age(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{date(s), will be coerced with \code{\link[=as.POSIXlt]{as.POSIXlt()}}}
|
||||
|
||||
\item{reference}{reference date(s) (defaults to today), will be coerced with \code{\link[=as.POSIXlt]{as.POSIXlt()}} and cannot be lower than \code{x}}
|
||||
\item{reference}{reference date(s) (defaults to today), will be coerced with \code{\link[=as.POSIXlt]{as.POSIXlt()}}}
|
||||
|
||||
\item{exact}{a logical to indicate whether age calculation should be exact, i.e. with decimals. It divides the number of days of \href{https://en.wikipedia.org/wiki/Year-to-date}{year-to-date} (YTD) of \code{x} by the number of days in the year of \code{reference} (either 365 or 366).}
|
||||
|
||||
\item{na.rm}{a logical to indicate whether missing values should be removed}
|
||||
|
||||
\item{...}{parameters passed on to \code{\link[=as.POSIXlt]{as.POSIXlt()}}, such as \code{origin}}
|
||||
}
|
||||
\value{
|
||||
An \link{integer} (no decimals) if \code{exact = FALSE}, a \link{double} (with decimals) otherwise
|
||||
@ -21,6 +23,9 @@ An \link{integer} (no decimals) if \code{exact = FALSE}, a \link{double} (with d
|
||||
\description{
|
||||
Calculates age in years based on a reference date, which is the sytem date at default.
|
||||
}
|
||||
\details{
|
||||
Ages below 0 will be returned as \code{NA} with a warning. Ages above 120 will only give a warning.
|
||||
}
|
||||
\section{Stable lifecycle}{
|
||||
|
||||
\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr}
|
||||
|
@ -22,14 +22,14 @@ Split ages into age groups defined by the \code{split} parameter. This allows fo
|
||||
\details{
|
||||
To split ages, the input for the \code{split_at} parameter can be:
|
||||
\itemize{
|
||||
\item A numeric vector. A vector of e.g. \code{c(10, 20)} will split on 0-9, 10-19 and 20+. A value of only \code{50} will split on 0-49 and 50+.
|
||||
\item A numeric vector. A value of e.g. \code{c(10, 20)} will split \code{x} on 0-9, 10-19 and 20+. A value of only \code{50} will split \code{x} on 0-49 and 50+.
|
||||
The default is to split on young children (0-11), youth (12-24), young adults (25-54), middle-aged adults (55-74) and elderly (75+).
|
||||
\item A character:
|
||||
\itemize{
|
||||
\item \code{"children"} or \code{"kids"}, equivalent of: \code{c(0, 1, 2, 4, 6, 13, 18)}. This will split on 0, 1, 2-3, 4-5, 6-12, 13-17 and 18+.
|
||||
\item \code{"elderly"} or \code{"seniors"}, equivalent of: \code{c(65, 75, 85)}. This will split on 0-64, 65-74, 75-84, 85+.
|
||||
\item \code{"fives"}, equivalent of: \code{1:20 * 5}. This will split on 0-4, 5-9, 10-14, ..., 90-94, 95-99, 100+.
|
||||
\item \code{"tens"}, equivalent of: \code{1:10 * 10}. This will split on 0-9, 10-19, 20-29, ..., 80-89, 90-99, 100+.
|
||||
\item \code{"fives"}, equivalent of: \code{1:20 * 5}. This will split on 0-4, 5-9, ..., 95-99, 100+.
|
||||
\item \code{"tens"}, equivalent of: \code{1:10 * 10}. This will split on 0-9, 10-19, ..., 90-99, 100+.
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,12 +64,11 @@ age_groups(ages, 1:20 * 5)
|
||||
age_groups(ages, split_at = "fives")
|
||||
|
||||
# split specifically for children
|
||||
age_groups(ages, "children")
|
||||
# same:
|
||||
age_groups(ages, c(1, 2, 4, 6, 13, 17))
|
||||
age_groups(ages, "children")
|
||||
|
||||
\donttest{
|
||||
# resistance of ciprofloxacine per age group
|
||||
# resistance of ciprofloxacin per age group
|
||||
library(dplyr)
|
||||
example_isolates \%>\%
|
||||
filter_first_isolate() \%>\%
|
||||
|
@ -85,7 +85,7 @@ if (require("dplyr")) {
|
||||
|
||||
# get bug/drug combinations for only macrolides in Gram-positives:
|
||||
example_isolates \%>\%
|
||||
filter(mo_gramstain(mo) \%like\% "pos") \%>\%
|
||||
filter(mo \%>\% is_gram_positive()) \%>\%
|
||||
select(mo, macrolides()) \%>\%
|
||||
bug_drug_combinations() \%>\%
|
||||
format()
|
||||
|
@ -60,7 +60,7 @@ is.rsi.eligible(x, threshold = 0.05)
|
||||
|
||||
\item{guideline}{defaults to the latest included EUCAST guideline, see Details for all options}
|
||||
|
||||
\item{uti}{(Urinary Tract Infection) A vector with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.rsi]{as.rsi()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be search for a 'specimen' and rows containing 'urin' in that column will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||
\item{uti}{(Urinary Tract Infection) A vector with \link{logical}s (\code{TRUE} or \code{FALSE}) to specify whether a UTI specific interpretation from the guideline should be chosen. For using \code{\link[=as.rsi]{as.rsi()}} on a \link{data.frame}, this can also be a column containing \link{logical}s or when left blank, the data set will be searched for a 'specimen' and rows containing 'urin' (such as 'urine', 'urina') in that column will be regarded isolates from a UTI. See \emph{Examples}.}
|
||||
|
||||
\item{conserve_capped_values}{a logical to indicate that MIC values starting with \code{">"} (but not \code{">="}) must always return "R" , and that MIC values starting with \code{"<"} (but not \code{"<="}) must always return "S"}
|
||||
|
||||
|
@ -29,11 +29,11 @@ bug_drug_combinations(x, col_mo = NULL, FUN = mo_shortname, ...)
|
||||
|
||||
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||
|
||||
\item{FUN}{the function to call on the \code{mo} column to transform the microorganism IDs, defaults to \code{\link[=mo_shortname]{mo_shortname()}}}
|
||||
\item{FUN}{function to call on the \code{mo} column to transform the microorganism IDs, defaults to \code{\link[=mo_shortname]{mo_shortname()}}}
|
||||
|
||||
\item{...}{arguments passed on to \code{FUN}}
|
||||
|
||||
\item{translate_ab}{a character of length 1 containing column names of the \link{antibiotics} data set}
|
||||
\item{translate_ab}{character of length 1 containing column names of the \link{antibiotics} data set}
|
||||
|
||||
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can also be set with \code{getOption("AMR_locale")}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
|
||||
|
||||
|
@ -10,8 +10,9 @@ As per their GPL-2 licence that demands documentation of code changes, the chang
|
||||
\enumerate{
|
||||
\item Rewritten code to remove the dependency on packages \code{plyr}, \code{scales} and \code{grid}
|
||||
\item Parametrised more options, like arrow and ellipse settings
|
||||
\item Hardened all input possibilities by defining the exact type of user input for every parameter
|
||||
\item Added total amount of explained variance as a caption in the plot
|
||||
\item Cleaned all syntax based on the \code{lintr} package and added integrity checks
|
||||
\item Cleaned all syntax based on the \code{lintr} package, fixed grammatical errors and added integrity checks
|
||||
\item Updated documentation
|
||||
}
|
||||
}
|
||||
@ -19,7 +20,7 @@ As per their GPL-2 licence that demands documentation of code changes, the chang
|
||||
ggplot_pca(
|
||||
x,
|
||||
choices = 1:2,
|
||||
scale = TRUE,
|
||||
scale = 1,
|
||||
pc.biplot = TRUE,
|
||||
labels = NULL,
|
||||
labels_textsize = 3,
|
||||
|
@ -20,7 +20,7 @@ A column name of \code{x}, or \code{NULL} when no result is found.
|
||||
This tries to find a column name in a data set based on information from the \link{antibiotics} data set. Also supports WHONET abbreviations.
|
||||
}
|
||||
\details{
|
||||
You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \link{antibiotics} data set for any column containing a name or code of that antibiotic. \strong{Longer columns names take precendence over shorter column names.}
|
||||
You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \link{antibiotics} data set for any column containing a name or code of that antibiotic. \strong{Longer columns names take precedence over shorter column names.}
|
||||
}
|
||||
\section{Stable lifecycle}{
|
||||
|
||||
|
@ -40,21 +40,21 @@ key_antibiotics_equal(
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{table with antibiotics coloms, like \code{AMX} or \code{amox}}
|
||||
\item{x}{a data.frame with antibiotics columns, like \code{AMX} or \code{amox}}
|
||||
|
||||
\item{col_mo}{column name of the IDs of the microorganisms (see \code{\link[=as.mo]{as.mo()}}), defaults to the first column of class \code{\link{mo}}. Values will be coerced using \code{\link[=as.mo]{as.mo()}}.}
|
||||
|
||||
\item{universal_1, universal_2, universal_3, universal_4, universal_5, universal_6}{column names of \strong{broad-spectrum} antibiotics, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link[=guess_ab_col]{guess_ab_col()}}.}
|
||||
\item{universal_1, universal_2, universal_3, universal_4, universal_5, universal_6}{column names of \strong{broad-spectrum} antibiotics, case-insensitive. See details for which antibiotics will be used at default (which are guessed with \code{\link[=guess_ab_col]{guess_ab_col()}}).}
|
||||
|
||||
\item{GramPos_1, GramPos_2, GramPos_3, GramPos_4, GramPos_5, GramPos_6}{column names of antibiotics for \strong{Gram-positives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link[=guess_ab_col]{guess_ab_col()}}.}
|
||||
\item{GramPos_1, GramPos_2, GramPos_3, GramPos_4, GramPos_5, GramPos_6}{column names of antibiotics for \strong{Gram-positives}, case-insensitive. See details for which antibiotics will be used at default (which are guessed with \code{\link[=guess_ab_col]{guess_ab_col()}}).}
|
||||
|
||||
\item{GramNeg_1, GramNeg_2, GramNeg_3, GramNeg_4, GramNeg_5, GramNeg_6}{column names of antibiotics for \strong{Gram-negatives}, case-insensitive. At default, the columns containing these antibiotics will be guessed with \code{\link[=guess_ab_col]{guess_ab_col()}}.}
|
||||
\item{GramNeg_1, GramNeg_2, GramNeg_3, GramNeg_4, GramNeg_5, GramNeg_6}{column names of antibiotics for \strong{Gram-negatives}, case-insensitive. See details for which antibiotics will be used at default (which are guessed with \code{\link[=guess_ab_col]{guess_ab_col()}}).}
|
||||
|
||||
\item{warnings}{give warning about missing antibiotic columns, they will anyway be ignored}
|
||||
\item{warnings}{give a warning about missing antibiotic columns (they will be ignored)}
|
||||
|
||||
\item{...}{other parameters passed on to function}
|
||||
\item{...}{other parameters passed on to functions}
|
||||
|
||||
\item{y, z}{characters to compare}
|
||||
\item{y, z}{character vectors to compare}
|
||||
|
||||
\item{type}{type to determine weighed isolates; can be \code{"keyantibiotics"} or \code{"points"}, see Details}
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
\alias{mo_domain}
|
||||
\alias{mo_type}
|
||||
\alias{mo_gramstain}
|
||||
\alias{is_gram_negative}
|
||||
\alias{is_gram_positive}
|
||||
\alias{mo_snomed}
|
||||
\alias{mo_ref}
|
||||
\alias{mo_authors}
|
||||
@ -55,6 +57,10 @@ mo_type(x, language = get_locale(), ...)
|
||||
|
||||
mo_gramstain(x, language = get_locale(), ...)
|
||||
|
||||
is_gram_negative(x, ...)
|
||||
|
||||
is_gram_positive(x, ...)
|
||||
|
||||
mo_snomed(x, language = get_locale(), ...)
|
||||
|
||||
mo_ref(x, language = get_locale(), ...)
|
||||
@ -76,7 +82,7 @@ mo_url(x, open = FALSE, language = get_locale(), ...)
|
||||
mo_property(x, property = "fullname", language = get_locale(), ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{any (vector of) text that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}}
|
||||
\item{x}{any character (vector) that can be coerced to a valid microorganism code with \code{\link[=as.mo]{as.mo()}}}
|
||||
|
||||
\item{language}{language of the returned text, defaults to system language (see \code{\link[=get_locale]{get_locale()}}) and can be overwritten by setting the option \code{AMR_locale}, e.g. \code{options(AMR_locale = "de")}, see \link{translate}. Use \code{language = NULL} or \code{language = ""} to prevent translation.}
|
||||
|
||||
@ -110,7 +116,7 @@ The short name - \code{\link[=mo_shortname]{mo_shortname()}} - almost always ret
|
||||
|
||||
Since the top-level of the taxonomy is sometimes referred to as 'kingdom' and sometimes as 'domain', the functions \code{\link[=mo_kingdom]{mo_kingdom()}} and \code{\link[=mo_domain]{mo_domain()}} return the exact same results.
|
||||
|
||||
The Gram stain - \code{\link[=mo_gramstain]{mo_gramstain()}} - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, \href{https://pubmed.ncbi.nlm.nih.gov/11837318}{PMID 11837318}), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value \code{NA}.
|
||||
The Gram stain - \code{\link[=mo_gramstain]{mo_gramstain()}} - will be determined based on the taxonomic kingdom and phylum. According to Cavalier-Smith (2002, \href{https://pubmed.ncbi.nlm.nih.gov/11837318}{PMID 11837318}), who defined subkingdoms Negibacteria and Posibacteria, only these phyla are Posibacteria: Actinobacteria, Chloroflexi, Firmicutes and Tenericutes. These bacteria are considered Gram-positive - all other bacteria are considered Gram-negative. Species outside the kingdom of Bacteria will return a value \code{NA}. Functions \code{\link[=is_gram_negative]{is_gram_negative()}} and \code{\link[=is_gram_positive]{is_gram_positive()}} always return \code{TRUE} or \code{FALSE}, even for species outside the kingdom of Bacteria.
|
||||
|
||||
All output will be \link{translate}d where possible.
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/p_symbol.R
|
||||
\name{p_symbol}
|
||||
\alias{p_symbol}
|
||||
\title{Symbol of a p-value}
|
||||
\usage{
|
||||
p_symbol(p, emptychar = " ")
|
||||
}
|
||||
\arguments{
|
||||
\item{p}{p value}
|
||||
|
||||
\item{emptychar}{text to show when \code{p > 0.1}}
|
||||
}
|
||||
\value{
|
||||
Text
|
||||
}
|
||||
\description{
|
||||
Return the symbol related to the p-value: 0 '\verb{***}' 0.001 '\verb{**}' 0.01 '\code{*}' 0.05 '\code{.}' 0.1 ' ' 1. Values above \code{p = 1} will return \code{NA}.
|
||||
}
|
||||
\details{
|
||||
\strong{NOTE}: this function will be moved to the \code{cleaner} package when a new version is being published on CRAN.
|
||||
}
|
||||
\section{Questioning lifecycle}{
|
||||
|
||||
\if{html}{\figure{lifecycle_questioning.svg}{options: style=margin-bottom:5px} \cr}
|
||||
The \link[=lifecycle]{lifecycle} of this function is \strong{questioning}. This function might be no longer be optimal approach, or is it questionable whether this function should be in this \code{AMR} package at all.
|
||||
}
|
||||
|
||||
\section{Read more on our website!}{
|
||||
|
||||
On our website \url{https://msberends.github.io/AMR/} you can find \href{https://msberends.github.io/AMR/articles/AMR.html}{a comprehensive tutorial} about how to conduct AMR analysis, the \href{https://msberends.github.io/AMR/reference/}{complete documentation of all functions} and \href{https://msberends.github.io/AMR/articles/WHONET.html}{an example analysis using WHONET data}. As we would like to better understand the backgrounds and needs of our users, please \href{https://msberends.github.io/AMR/survey.html}{participate in our survey}!
|
||||
}
|
||||
|
Reference in New Issue
Block a user