A data set with 67,151 rows and 16 columns, containing the following column names:
‘mo’, ‘fullname’, ‘kingdom’, ‘phylum’, ‘class’, ‘order’, ‘family’, ‘genus’, ‘species’, ‘subspecies’, ‘rank’, ‘ref’, ‘species_id’, ‘source’, ‘prevalence’, ‘snomed’.
This data set is in R available as microorganisms
, after you load the AMR
package.
It was last updated on 28 July 2020 20:52:40 CEST. Find more info about the structure of this data set here.
- +It was last updated on 1 September 2020 11:07:11 CEST. Find more info about the structure of this data set here.
+A data set with 102 rows and 9 columns, containing the following column names:
‘atc’, ‘cid’, ‘name’, ‘atc_group’, ‘synonyms’, ‘oral_ddd’, ‘oral_units’, ‘iv_ddd’, ‘iv_units’.
This data set is in R available as antivirals
, after you load the AMR
package.
It was last updated on 29 August 2020 21:36:44 CEST. Find more info about the structure of this data set here.
- +It was last updated on 29 August 2020 21:53:07 CEST. Find more info about the structure of this data set here.
+NEWS.md
Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt to. We are those reviewers very grateful for going through our code so thoroughly!
Although advertised that this package should work under R 3.0.0, we still had a dependency on R 3.6.0. This is fixed, meaning that our package should now work under R 3.0.0.
Improvements for as.rsi()
:
Improvements for as.mo()
:
mo_*
functions like mo_name()
on microoganism IDs.ignore_pattern
to as.mo()
which can also be given to mo_*
functions like mo_name()
, to exclude known non-relevant input from analysing. This can also be set with the option AMR_ignore_pattern
.get_locale()
now uses Sys.getlocale()
instead of Sys.getlocale("LC_COLLATE")
Speed improvement for eucast_rules()
Overall speed improvement by tweaking joining functions
Function mo_shortname()
now returns the genus for input where the species is unknown
Names of antiviral agents in data set antivirals
now have a starting capital letter, like it is the case in the antibiotics
data set
Fixed a bug where as.mic()
could not handle dots without a leading zero (like "<=.25
)
p.symbol()
- it was replaced with p_symbol()
as.rsi()
for years 2010-2019 (thanks to Anthony Underwood)dplyr
version 1.0.0rsi
and mic
@@ -587,9 +605,9 @@ This works for all drug combinations, such as ampicillin/sulbactam, ceftazidime/
CITATION
fileclean
to cleaner
, as this package was renamed accordingly upon CRAN requestas.mic()
)lintr
packagemo_shortname()
where species would not be determined correctly%like%
, it will now return the callPercentages will now will rounded more logically (e.g. in freq
function)
crayon
, to support formatted text in the consoletidyr
is now mandatory (went to Import
field) since portion_df
and count_df
rely on itas.rsi
and as.mic
now add the package name and version as attributesREADME.md
with more examplesThis example data set has the exact same structure as an export file from WHONET. Such files can be used with this package, as this example data set shows. The data itself was based on our example_isolates data set.
+This example data set has the exact same structure as an export file from WHONET. Such files can be used with this package, as this example data set shows. The antibiotic results are based on our example_isolates data set. All patient names are created using online surname generators and are only in place for practice purposes.
WHONET
@@ -253,10 +253,10 @@
Organism
Name of the microorganism. Before analysis, you should transform this to a valid microbial class, using as.mo()
.
Country
Country of origin
Laboratory
Name of laboratory
Last name
Last name of patient
First name
Initial of patient
Sex
Gender of patient
Age
Age of patient
Last name
Fictitious last name of patient
First name
Fictitious initial of patient
Sex
Fictitious gender of patient
Age
Fictitious age of patient
Age category
Age group, can also be looked up using age_groups()
Date of admission
Date of hospital admission
Specimen date
Date when specimen was received at laboratory
R/ab_property.R
ab_property.Rd
This transforms a vector to a new class disk
, which is a growth zone size (around an antibiotic disk) in millimetres between 6 and 50.
This transforms a vector to a new class disk
, which is a disk diffusion growth zone size (around an antibiotic disk) in millimetres between 6 and 50.
as.disk(x, na.rm = FALSE) diff --git a/docs/reference/as.mic.html b/docs/reference/as.mic.html index 5c3280a50..80eeff941 100644 --- a/docs/reference/as.mic.html +++ b/docs/reference/as.mic.html @@ -6,7 +6,7 @@ -Class 'mic' — as.mic • AMR (for R) +Transform input to minimum inhibitory concentrations — as.mic • AMR (for R) @@ -48,8 +48,8 @@ - - + + @@ -82,7 +82,7 @@
This transforms a vector to a new class mic
, which is an ordered factor
with valid MIC values as levels. Invalid MIC values will be translated as NA
with a warning.
This transforms a vector to a new class mic
, which is an ordered factor
with valid minimum inhibitory concentrations (MIC) as levels. Invalid MIC values will be translated as NA
with a warning.
as.mic(x, na.rm = FALSE) diff --git a/docs/reference/as.mo.html b/docs/reference/as.mo.html index 8b167a169..9d9a4a1ff 100644 --- a/docs/reference/as.mo.html +++ b/docs/reference/as.mo.html @@ -6,7 +6,7 @@ -Transform to microorganism ID — as.mo • AMR (for R) +Transform input to a microorganism ID — as.mo • AMR (for R) @@ -48,7 +48,7 @@ - + @@ -82,7 +82,7 @@
a data.frame
to be used for extra reference when translating x
to a valid mo
. See set_mo_source()
and get_mo_source()
to automate the usage of your own codes (e.g. used in your analysis or organisation).
a regular expression (case-insensitive) of which all matches in x
must return NA
. This can be convenient to exclude known non-relevant input and can also be set with the option AMR_ignore_pattern
, e.g. options(AMR_ignore_pattern = "(not reported|contaminated flora)")
.
other parameters passed on to functions
A microorganism ID from this package (class: mo
) typically looks like these examples:
Code Full name +A microorganism ID from this package (class:
mo
) is human readable and typically looks like these examples:Code Full name --------------- -------------------------------------- B_KLBSL Klebsiella B_KLBSL_PNMN Klebsiella pneumoniae B_KLBSL_PNMN_RHNS Klebsiella pneumoniae rhinoscleromatis | | | | | | | | - | | | ---> subspecies, a 4-5 letter acronym - | | ----> species, a 4-5 letter acronym - | ----> genus, a 5-7 letter acronym - ----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria), + | | | \---> subspecies, a 4-5 letter acronym + | | \----> species, a 4-5 letter acronym + | \----> genus, a 5-7 letter acronym + \----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria), C (Chromista), F (Fungi), P (Protozoa)diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index f40dcb3e4..f66af5681 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -6,7 +6,7 @@ -Class 'rsi' — as.rsi • AMR (for R) +Interpret MIC and disk, or clean raw R/SI data — as.rsi • AMR (for R) @@ -48,7 +48,7 @@ - + @@ -82,7 +82,7 @@ @@ -122,7 +122,7 @@ - Download our reference data sets for own use + Data sets for download / own use
Gets data from the WHO to determine properties of an ATC (e.g. an antibiotic) like name, defined daily dose (DDD) or standard unit.
-This function requires an internet connection.
atc_online_property(
@@ -309,12 +307,14 @@ This function requires an internet connection." />
"ml"
= milliliter (e.g. eyedrops)
N.B. This function requires an internet connection and only works if the following packages are installed: curl
, rvest
, xml2
.
-The lifecycle of this function is questioning. This function might be no longer be optimal approach, or is it questionable whether this function should be in this AMR
package at all.
+The lifecycle of this function is stable. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided.
If the unlying code needs breaking changes, they will occur gradually. For example, a parameter will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error.
The function format()
calculates the resistance per bug-drug combination. Use combine_IR = FALSE
(default) to test R vs. S+I and combine_IR = TRUE
to test R+I vs. S.
The language of the output can be overwritten with options(AMR_locale)
, please see translate.
Functions for cleaning and optimising your data, to be able to add variables later on (like taxonomic properties) or to fix and extend antibiotic interpretations by applying EUCAST rules.
+Some pages about our package and its external sources. Be sure to read our How To’s for more information about how to work with functions in this package.
Transform to antibiotic ID
The AMR
Package
Class 'disk'
The Catalogue of Life
Class 'mic'
Version info of included Catalogue of Life
as.mo()
is.mo()
mo_failures()
mo_uncertainties()
mo_renamed()
Transform to microorganism ID
WHOCC: WHO Collaborating Centre for Drug Statistics Methodology
Class 'rsi'
Lifecycles of functions in the AMR
package
Apply EUCAST rules
Retrieve antimicrobial drug names and doses from clinical text
Guess antibiotic column
User-defined reference data set for microorganisms
Functions to add new data to your existing data, such as the determination of first isolates, multi-drug resistant microorganisms (MDRO), getting properties of microorganisms or antibiotics and determining the age of patients or divide ages into age groups.
-ab_name()
ab_atc()
ab_cid()
ab_synonyms()
ab_tradenames()
ab_group()
ab_atc_group1()
ab_atc_group2()
ab_loinc()
ab_ddd()
ab_info()
ab_url()
ab_property()
Property of an antibiotic
Split ages into age groups
Age in years of individuals
Get ATC properties from WHOCC website
first_isolate()
filter_first_isolate()
filter_first_weighted_isolate()
Determine first (weighted) isolates
inner_join_microorganisms()
left_join_microorganisms()
right_join_microorganisms()
full_join_microorganisms()
semi_join_microorganisms()
anti_join_microorganisms()
Join microorganisms to a data set
Key antibiotics for first weighted isolates
mdro()
brmo()
mrgn()
mdr_tb()
mdr_cmi2012()
eucast_exceptional_phenotypes()
Determine multidrug-resistant organisms (MDRO)
mo_name()
mo_fullname()
mo_shortname()
mo_subspecies()
mo_species()
mo_genus()
mo_family()
mo_order()
mo_class()
mo_phylum()
mo_kingdom()
mo_domain()
mo_type()
mo_gramstain()
mo_snomed()
mo_ref()
mo_authors()
mo_year()
mo_rank()
mo_taxonomy()
mo_synonyms()
mo_info()
mo_url()
mo_property()
Property of a microorganism
Symbol of a p-value
Functions for conducting AMR analysis, like counting isolates, calculating resistance or susceptibility, or make plots.
-resistance()
susceptibility()
proportion_R()
proportion_IR()
proportion_I()
proportion_SI()
proportion_S()
proportion_df()
rsi_df()
Calculate microbial resistance
count_resistant()
count_susceptible()
count_R()
count_IR()
count_I()
count_SI()
count_S()
count_all()
n_rsi()
count_df()
Count available isolates
Check availability of columns
Determine bug-drug combinations
resistance_predict()
rsi_predict()
plot(<resistance_predict>)
ggplot_rsi_predict()
Predict antimicrobial resistance
Principal Component Analysis (for AMR)
ab_class()
aminoglycosides()
carbapenems()
cephalosporins()
cephalosporins_1st()
cephalosporins_2nd()
cephalosporins_3rd()
cephalosporins_4th()
cephalosporins_5th()
fluoroquinolones()
glycopeptides()
macrolides()
penicillins()
tetracyclines()
Antibiotic class selectors
filter_ab_class()
filter_aminoglycosides()
filter_carbapenems()
filter_cephalosporins()
filter_1st_cephalosporins()
filter_2nd_cephalosporins()
filter_3rd_cephalosporins()
filter_4th_cephalosporins()
filter_5th_cephalosporins()
filter_fluoroquinolones()
filter_glycopeptides()
filter_macrolides()
filter_penicillins()
filter_tetracyclines()
Filter isolates on result in antimicrobial class
G-test for Count Data
ggplot_rsi()
geom_rsi()
facet_rsi()
scale_y_percent()
scale_rsi_colours()
theme_rsi()
labels_rsi_count()
AMR plots with ggplot2
PCA biplot with ggplot2
Kurtosis of the sample
Skewness of the sample
Scientifically reliable references for microorganisms and antibiotics, and example data sets to use for practise.
-Translation table with 5,583 common microorganism codes
Data set with 5,583 common microorganism codes
Some pages about our package and its external sources. Be sure to read our How To’s for more information about how to work with functions in this package.
+These functions are meant to get taxonomically valid properties of microorganisms from any input. Use mo_source()
to teach this package how to translate your own codes to valid microorganism codes.
as.mo()
is.mo()
mo_failures()
mo_uncertainties()
mo_renamed()
The AMR
Package
Transform input to a microorganism ID
mo_name()
mo_fullname()
mo_shortname()
mo_subspecies()
mo_species()
mo_genus()
mo_family()
mo_order()
mo_class()
mo_phylum()
mo_kingdom()
mo_domain()
mo_type()
mo_gramstain()
mo_snomed()
mo_ref()
mo_authors()
mo_year()
mo_rank()
mo_taxonomy()
mo_synonyms()
mo_info()
mo_url()
mo_property()
The Catalogue of Life
Get properties of a microorganism
Version info of included Catalogue of Life
WHOCC: WHO Collaborating Centre for Drug Statistics Methodology
Lifecycles of functions in the AMR
package
User-defined reference data set for microorganisms
Use these functions to get valid properties of antibiotics from any input or to clean your input. You can even retrieve drug names and doses from clinical text records, using ab_from_text()
.
Transform input to an antibiotic ID
ab_name()
ab_atc()
ab_cid()
ab_synonyms()
ab_tradenames()
ab_group()
ab_atc_group1()
ab_atc_group2()
ab_loinc()
ab_ddd()
ab_info()
ab_url()
ab_property()
Get properties of an antibiotic
Retrieve antimicrobial drug names and doses from clinical text
Get ATC properties from WHOCC website
With as.mic()
and as.disk()
you can transform your raw input to valid MIC or disk diffusion values. Use as.rsi()
for cleaning raw data to let it only contain “R”, “I” and “S”, or to interpret MIC or disk diffusion values as R/SI based on the lastest EUCAST and CLSI guidelines. Afterwards, you can extend antibiotic interpretations by applying EUCAST rules with eucast_rules()
.
Interpret MIC and disk, or clean raw R/SI data
Transform input to minimum inhibitory concentrations
Transform input to disk diffusion diameters
Apply EUCAST rules
Use these function for the analysis part. You can use susceptibility()
or resistance()
on any antibiotic column. Be sure to first select the isolates that are appropiate for analysis, by using first_isolate()
. You can also filter your data on certain resistance in certain antibiotic classes (filter_ab_class()
), or determine multi-drug resistant microorganisms (MDRO, mdro()
).
resistance()
susceptibility()
proportion_R()
proportion_IR()
proportion_I()
proportion_SI()
proportion_S()
proportion_df()
rsi_df()
Calculate microbial resistance
count_resistant()
count_susceptible()
count_R()
count_IR()
count_I()
count_SI()
count_S()
count_all()
n_rsi()
count_df()
Count available isolates
first_isolate()
filter_first_isolate()
filter_first_weighted_isolate()
Determine first (weighted) isolates
Key antibiotics for first weighted isolates
mdro()
brmo()
mrgn()
mdr_tb()
mdr_cmi2012()
eucast_exceptional_phenotypes()
Determine multidrug-resistant organisms (MDRO)
ggplot_rsi()
geom_rsi()
facet_rsi()
scale_y_percent()
scale_rsi_colours()
theme_rsi()
labels_rsi_count()
AMR plots with ggplot2
Determine bug-drug combinations
ab_class()
aminoglycosides()
carbapenems()
cephalosporins()
cephalosporins_1st()
cephalosporins_2nd()
cephalosporins_3rd()
cephalosporins_4th()
cephalosporins_5th()
fluoroquinolones()
glycopeptides()
macrolides()
penicillins()
tetracyclines()
Antibiotic class selectors
filter_ab_class()
filter_aminoglycosides()
filter_carbapenems()
filter_cephalosporins()
filter_1st_cephalosporins()
filter_2nd_cephalosporins()
filter_3rd_cephalosporins()
filter_4th_cephalosporins()
filter_5th_cephalosporins()
filter_fluoroquinolones()
filter_glycopeptides()
filter_macrolides()
filter_penicillins()
filter_tetracyclines()
Filter isolates on result in antimicrobial class
resistance_predict()
rsi_predict()
plot(<resistance_predict>)
ggplot_rsi_predict()
Predict antimicrobial resistance
Guess antibiotic column
These functions are mostly for internal use, but some of them may also be suitable for your analysis. Especially the ‘like’ function can be useful: if (x %like% y) {...}
.
Pattern Matching
Split ages into age groups
Age in years of individuals
inner_join_microorganisms()
left_join_microorganisms()
right_join_microorganisms()
full_join_microorganisms()
semi_join_microorganisms()
anti_join_microorganisms()
Join microorganisms to a data set
Check availability of columns
Principal Component Analysis (for AMR)
PCA biplot with ggplot2
Some statistical tests or methods are not part of base R and are added to this package for convenience.
+G-test for Count Data
Kurtosis of the sample
Skewness of the sample
Symbol of a p-value
These functions are deprecated, meaning that they will still work but show a warning with every use and will be removed in a future version.
The %like%
function:
Is case insensitive (use %like_case%
for case-sensitive matching)
Is case-insensitive (use %like_case%
for case-sensitive matching)
Supports multiple patterns
Checks if pattern
is a regular expression and sets fixed = TRUE
if not, to greatly improve speed
Tries again with perl = TRUE
if regex fails
# simple test diff --git a/docs/reference/microorganisms.codes.html b/docs/reference/microorganisms.codes.html index 1d5be99c4..ba2f5b8d9 100644 --- a/docs/reference/microorganisms.codes.html +++ b/docs/reference/microorganisms.codes.html @@ -6,7 +6,7 @@ -Translation table with 5,583 common microorganism codes — microorganisms.codes • AMR (for R) +Data set with 5,583 common microorganism codes — microorganisms.codes • AMR (for R) @@ -48,7 +48,7 @@ - + @@ -82,7 +82,7 @@ @@ -122,7 +122,7 @@ - Download our reference data sets for own use + Data sets for download / own use
R/data.R
microorganisms.codes.Rd
R/mo_property.R
mo_property.Rd
Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with as.mo()
, which makes it possible to use microbial abbreviations, codes and names as input. Please see Examples.
Use these functions to return a specific property of a microorganism based on the latest accepted taxonomy. All input values will be evaluated internally with as.mo()
, which makes it possible to use microbial abbreviations, codes and names as input. Please see Examples.
mo_name(x, language = get_locale(), ...) @@ -299,11 +299,11 @@language -+ language of the returned text, defaults to system language (see
get_locale()
) and can also be set withgetOption("AMR_locale")
. Uselanguage = NULL
orlanguage = ""
to prevent translation.language of the returned text, defaults to system language (see
get_locale()
) and can be overwritten by setting the optionAMR_locale
, e.g.options(AMR_locale = "de")
, see translate. Uselanguage = NULL
orlanguage = ""
to prevent translation.... -+ other parameters passed on to
as.mo()
other parameters passed on to
as.mo()
, such as 'allow_uncertain' and 'ignore_pattern'open diff --git a/docs/reference/translate.html b/docs/reference/translate.html index 90457980f..40195b029 100644 --- a/docs/reference/translate.html +++ b/docs/reference/translate.html @@ -82,7 +82,7 @@ @@ -122,7 +122,7 @@ - Download our reference data sets for own use + Data sets for download / own use@@ -247,11 +247,10 @@ Details
-Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv.
-Currently supported languages are (besides English): Dutch, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.
+Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv. This file will be read by all functions where a translated output can be desired, like all
+mo_property()
functions (mo_name()
,mo_gramstain()
,mo_type()
, etc.).Currently supported languages are: Dutch, English, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names.
Please suggest your own translations by creating a new issue on our repository.
-This file will be read by all functions where a translated output can be desired, like all
-mo_property()
functions (mo_name()
,mo_gramstain()
,mo_type()
, etc.).The system language will be used at default, if that language is supported. The system language can be overwritten with
+Sys.setenv(AMR_locale = yourlanguage)
.The system language will be used at default (as returned by
Sys.getlocale()
), if that language is supported. The language to be used can be overwritten by setting the optionAMR_locale
, e.g.options(AMR_locale = "de")
.Stable lifecycle
diff --git a/docs/survey.html b/docs/survey.html index 928f14e0d..252145a7f 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ @@ -121,7 +121,7 @@ - Download our reference data sets for own use + Data sets for download / own usediff --git a/man/WHONET.Rd b/man/WHONET.Rd index c8c03740f..ebd34b803 100644 --- a/man/WHONET.Rd +++ b/man/WHONET.Rd @@ -12,10 +12,10 @@ A \code{\link{data.frame}} with 500 observations and 53 variables: \item \code{Organism}\cr Name of the microorganism. Before analysis, you should transform this to a valid microbial class, using \code{\link[=as.mo]{as.mo()}}. \item \code{Country}\cr Country of origin \item \code{Laboratory}\cr Name of laboratory -\item \verb{Last name}\cr Last name of patient -\item \verb{First name}\cr Initial of patient -\item \code{Sex}\cr Gender of patient -\item \code{Age}\cr Age of patient +\item \verb{Last name}\cr Fictitious last name of patient +\item \verb{First name}\cr Fictitious initial of patient +\item \code{Sex}\cr Fictitious gender of patient +\item \code{Age}\cr Fictitious age of patient \item \verb{Age category}\cr Age group, can also be looked up using \code{\link[=age_groups]{age_groups()}} \item \verb{Date of admission}\cr Date of hospital admission \item \verb{Specimen date}\cr Date when specimen was received at laboratory @@ -39,7 +39,7 @@ A \code{\link{data.frame}} with 500 observations and 53 variables: WHONET } \description{ -This example data set has the exact same structure as an export file from WHONET. Such files can be used with this package, as this example data set shows. The data itself was based on our \link{example_isolates} data set. +This example data set has the exact same structure as an export file from WHONET. Such files can be used with this package, as this example data set shows. The antibiotic results are based on our \link{example_isolates} data set. All patient names are created using online surname generators and are only in place for practice purposes. } \section{Reference data publicly available}{ diff --git a/man/ab_property.Rd b/man/ab_property.Rd index 19d33c19d..e31194420 100644 --- a/man/ab_property.Rd +++ b/man/ab_property.Rd @@ -15,7 +15,7 @@ \alias{ab_ddd} \alias{ab_info} \alias{ab_url} -\title{Property of an antibiotic} +\title{Get properties of an antibiotic} \usage{ ab_name(x, language = get_locale(), tolower = FALSE, ...) diff --git a/man/as.ab.Rd b/man/as.ab.Rd index f53ff8025..98ef6213b 100644 --- a/man/as.ab.Rd +++ b/man/as.ab.Rd @@ -4,7 +4,7 @@ \alias{as.ab} \alias{ab} \alias{is.ab} -\title{Transform to antibiotic ID} +\title{Transform input to an antibiotic ID} \usage{ as.ab(x, flag_multiple_results = TRUE, info = TRUE, ...) diff --git a/man/as.disk.Rd b/man/as.disk.Rd index f8b349da7..23bc498c4 100644 --- a/man/as.disk.Rd +++ b/man/as.disk.Rd @@ -4,7 +4,7 @@ \alias{as.disk} \alias{disk} \alias{is.disk} -\title{Class 'disk'} +\title{Transform input to disk diffusion diameters} \usage{ as.disk(x, na.rm = FALSE) @@ -19,7 +19,7 @@ is.disk(x) An \code{\link{integer}} with additional new class \code{\link{disk}} } \description{ -This transforms a vector to a new class \code{\link{disk}}, which is a growth zone size (around an antibiotic disk) in millimetres between 6 and 50. +This transforms a vector to a new class \code{\link{disk}}, which is a disk diffusion growth zone size (around an antibiotic disk) in millimetres between 6 and 50. } \details{ Interpret disk values as RSI values with \code{\link[=as.rsi]{as.rsi()}}. It supports guidelines from EUCAST and CLSI. diff --git a/man/as.mic.Rd b/man/as.mic.Rd index 6c648cee9..35a42364a 100755 --- a/man/as.mic.Rd +++ b/man/as.mic.Rd @@ -4,7 +4,7 @@ \alias{as.mic} \alias{mic} \alias{is.mic} -\title{Class 'mic'} +\title{Transform input to minimum inhibitory concentrations} \usage{ as.mic(x, na.rm = FALSE) @@ -19,7 +19,7 @@ is.mic(x) Ordered \code{\link{factor}} with new class \code{\link{mic}} } \description{ -This transforms a vector to a new class \code{\link{mic}}, which is an ordered \code{\link{factor}} with valid MIC values as levels. Invalid MIC values will be translated as \code{NA} with a warning. +This transforms a vector to a new class \code{\link{mic}}, which is an ordered \code{\link{factor}} with valid minimum inhibitory concentrations (MIC) as levels. Invalid MIC values will be translated as \code{NA} with a warning. } \details{ To interpret MIC values as RSI values, use \code{\link[=as.rsi]{as.rsi()}} on MIC values. It supports guidelines from EUCAST and CLSI. diff --git a/man/as.mo.Rd b/man/as.mo.Rd index c39ce545f..9571edbcc 100644 --- a/man/as.mo.Rd +++ b/man/as.mo.Rd @@ -7,7 +7,7 @@ \alias{mo_failures} \alias{mo_uncertainties} \alias{mo_renamed} -\title{Transform to microorganism ID} +\title{Transform input to a microorganism ID} \usage{ as.mo( x, @@ -15,6 +15,7 @@ as.mo( Lancefield = FALSE, allow_uncertain = TRUE, reference_df = get_mo_source(), + ignore_pattern = getOption("AMR_ignore_pattern"), ... ) @@ -41,6 +42,8 @@ This excludes \emph{Enterococci} at default (who are in group D), use \code{Lanc \item{reference_df}{a \code{\link{data.frame}} to be used for extra reference when translating \code{x} to a valid \code{\link{mo}}. See \code{\link[=set_mo_source]{set_mo_source()}} and \code{\link[=get_mo_source]{get_mo_source()}} to automate the usage of your own codes (e.g. used in your analysis or organisation).} +\item{ignore_pattern}{a regular expression (case-insensitive) of which all matches in \code{x} must return \code{NA}. This can be convenient to exclude known non-relevant input and can also be set with the option \code{AMR_ignore_pattern}, e.g. \code{options(AMR_ignore_pattern = "(not reported|contaminated flora)")}.} + \item{...}{other parameters passed on to functions} } \value{ @@ -52,17 +55,17 @@ Use this function to determine a valid microorganism ID (\code{\link{mo}}). Dete \details{ \subsection{General info}{ -A microorganism ID from this package (class: \code{\link{mo}}) typically looks like these examples:\preformatted{ Code Full name +A microorganism ID from this package (class: \code{\link{mo}}) is human readable and typically looks like these examples:\preformatted{ Code Full name --------------- -------------------------------------- B_KLBSL Klebsiella B_KLBSL_PNMN Klebsiella pneumoniae B_KLBSL_PNMN_RHNS Klebsiella pneumoniae rhinoscleromatis | | | | | | | | - | | | ---> subspecies, a 4-5 letter acronym - | | ----> species, a 4-5 letter acronym - | ----> genus, a 5-7 letter acronym - ----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria), + | | | \\---> subspecies, a 4-5 letter acronym + | | \\----> species, a 4-5 letter acronym + | \\----> genus, a 5-7 letter acronym + \\----> taxonomic kingdom: A (Archaea), AN (Animalia), B (Bacteria), C (Chromista), F (Fungi), P (Protozoa) } diff --git a/man/as.rsi.Rd b/man/as.rsi.Rd index a1d713efb..c65ca610c 100755 --- a/man/as.rsi.Rd +++ b/man/as.rsi.Rd @@ -8,7 +8,7 @@ \alias{as.rsi.mic} \alias{as.rsi.disk} \alias{as.rsi.data.frame} -\title{Class 'rsi'} +\title{Interpret MIC and disk, or clean raw R/SI data} \usage{ as.rsi(x, ...) diff --git a/man/atc_online.Rd b/man/atc_online.Rd index d61944857..2abb65184 100644 --- a/man/atc_online.Rd +++ b/man/atc_online.Rd @@ -33,8 +33,6 @@ atc_online_ddd(atc_code, ...) } \description{ Gets data from the WHO to determine properties of an ATC (e.g. an antibiotic) like name, defined daily dose (DDD) or standard unit. - -\strong{This function requires an internet connection.} } \details{ Options for parameter \code{administration}: @@ -62,11 +60,15 @@ Abbreviations of return values when using \code{property = "U"} (unit): \item \code{"mmol"} = millimole \item \code{"ml"} = milliliter (e.g. eyedrops) } -} -\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. +\strong{N.B. This function requires an internet connection and only works if the following packages are installed: \code{curl}, \code{rvest}, \code{xml2}.} +} +\section{Stable lifecycle}{ + +\if{html}{\figure{lifecycle_stable.svg}{options: style=margin-bottom:5px} \cr} +The \link[=lifecycle]{lifecycle} of this function is \strong{stable}. In a stable function, major changes are unlikely. This means that the unlying code will generally evolve by adding new arguments; removing arguments or changing the meaning of existing arguments will be avoided. + +If the unlying code needs breaking changes, they will occur gradually. For example, a parameter will be deprecated and first continue to work, but will emit an message informing you of the change. Next, typically after at least one newly released version on CRAN, the message will be transformed to an error. } \section{Read more on our website!}{ diff --git a/man/bug_drug_combinations.Rd b/man/bug_drug_combinations.Rd index 5026d8a05..c504c5472 100644 --- a/man/bug_drug_combinations.Rd +++ b/man/bug_drug_combinations.Rd @@ -62,8 +62,6 @@ Determine antimicrobial resistance (AMR) of all bug-drug combinations in your da } \details{ The function \code{\link[=format]{format()}} calculates the resistance per bug-drug combination. Use \code{combine_IR = FALSE} (default) to test R vs. S+I and \code{combine_IR = TRUE} to test R+I vs. S. - -The language of the output can be overwritten with \code{options(AMR_locale)}, please see \link{translate}. } \section{Stable lifecycle}{ diff --git a/man/like.Rd b/man/like.Rd index ed322c12e..24be196b8 100755 --- a/man/like.Rd +++ b/man/like.Rd @@ -31,7 +31,7 @@ Convenient wrapper around \code{\link[=grep]{grep()}} to match a pattern: \code{ \details{ The \verb{\%like\%} function: \itemize{ -\item Is case insensitive (use \verb{\%like_case\%} for case-sensitive matching) +\item Is case-insensitive (use \verb{\%like_case\%} for case-sensitive matching) \item Supports multiple patterns \item Checks if \code{pattern} is a regular expression and sets \code{fixed = TRUE} if not, to greatly improve speed \item Tries again with \code{perl = TRUE} if regex fails @@ -75,5 +75,5 @@ example_isolates \%>\% } } \seealso{ -\code{\link[base:grep]{base::grep()}} +\code{\link[=grep]{grep()}} } diff --git a/man/microorganisms.codes.Rd b/man/microorganisms.codes.Rd index 5a23c10a5..4ffcce2c6 100644 --- a/man/microorganisms.codes.Rd +++ b/man/microorganisms.codes.Rd @@ -3,7 +3,7 @@ \docType{data} \name{microorganisms.codes} \alias{microorganisms.codes} -\title{Translation table with 5,583 common microorganism codes} +\title{Data set with 5,583 common microorganism codes} \format{ A \code{\link{data.frame}} with 5,583 observations and 2 variables: \itemize{ diff --git a/man/mo_property.Rd b/man/mo_property.Rd index 523071db3..fe7900d5d 100644 --- a/man/mo_property.Rd +++ b/man/mo_property.Rd @@ -25,7 +25,7 @@ \alias{mo_synonyms} \alias{mo_info} \alias{mo_url} -\title{Property of a microorganism} +\title{Get properties of a microorganism} \usage{ mo_name(x, language = get_locale(), ...) @@ -78,9 +78,9 @@ 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{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.} +\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.} -\item{...}{other parameters passed on to \code{\link[=as.mo]{as.mo()}}} +\item{...}{other parameters passed on to \code{\link[=as.mo]{as.mo()}}, such as 'allow_uncertain' and 'ignore_pattern'} \item{open}{browse the URL using \code{\link[utils:browseURL]{utils::browseURL()}}} @@ -96,7 +96,7 @@ mo_property(x, property = "fullname", language = get_locale(), ...) } } \description{ -Use these functions to return a specific property of a microorganism. All input values will be evaluated internally with \code{\link[=as.mo]{as.mo()}}, which makes it possible to use microbial abbreviations, codes and names as input. Please see \emph{Examples}. +Use these functions to return a specific property of a microorganism based on the latest accepted taxonomy. All input values will be evaluated internally with \code{\link[=as.mo]{as.mo()}}, which makes it possible to use microbial abbreviations, codes and names as input. Please see \emph{Examples}. } \details{ All functions will return the most recently known taxonomic property according to the Catalogue of Life, except for \code{\link[=mo_ref]{mo_ref()}}, \code{\link[=mo_authors]{mo_authors()}} and \code{\link[=mo_year]{mo_year()}}. Please refer to this example, knowing that \emph{Escherichia blattae} was renamed to \emph{Shimwellia blattae} in 2010: diff --git a/man/translate.Rd b/man/translate.Rd index 6cbdb57eb..ce48cba2e 100644 --- a/man/translate.Rd +++ b/man/translate.Rd @@ -11,15 +11,13 @@ get_locale() For language-dependent output of AMR functions, like \code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}} and \code{\link[=ab_name]{ab_name()}}. } \details{ -Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: \url{https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv}. +Strings will be translated to foreign languages if they are defined in a local translation file. Additions to this file can be suggested at our repository. The file can be found here: \url{https://github.com/msberends/AMR/blob/master/data-raw/translations.tsv}. This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_property()}} functions (\code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}}, etc.). -Currently supported languages are (besides English): Dutch, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names. +Currently supported languages are: Dutch, English, French, German, Italian, Portuguese, Spanish. Please note that currently not all these languages have translations available for all antimicrobial agents and colloquial microorganism names. Please suggest your own translations \href{https://github.com/msberends/AMR/issues/new?title=Translations}{by creating a new issue on our repository}. -This file will be read by all functions where a translated output can be desired, like all \code{\link[=mo_property]{mo_property()}} functions (\code{\link[=mo_name]{mo_name()}}, \code{\link[=mo_gramstain]{mo_gramstain()}}, \code{\link[=mo_type]{mo_type()}}, etc.). - -The system language will be used at default, if that language is supported. The system language can be overwritten with \code{Sys.setenv(AMR_locale = yourlanguage)}. +The system language will be used at default (as returned by \code{\link[=Sys.getlocale]{Sys.getlocale()}}), if that language is supported. The language to be used can be overwritten by setting the option \code{AMR_locale}, e.g. \code{options(AMR_locale = "de")}. } \section{Stable lifecycle}{ diff --git a/pkgdown/extra.css b/pkgdown/extra.css index 214d451bb..5e507034a 100644 --- a/pkgdown/extra.css +++ b/pkgdown/extra.css @@ -276,8 +276,9 @@ table a:not(.btn):hover, .table a:not(.btn):hover { display: none; } .dataset-download-button { - margin-right: 10px; + margin-right: 2%; } .dataset-download-button img { - height: 100px !important; + width: 80px !important; + max-width: 14% !important; } diff --git a/tests/testthat/test-ab_property.R b/tests/testthat/test-ab_property.R index bbe425f09..8ca75e0cb 100644 --- a/tests/testthat/test-ab_property.R +++ b/tests/testthat/test-ab_property.R @@ -24,30 +24,30 @@ context("ab_property.R") test_that("ab_property works", { skip_on_cran() - expect_identical(ab_name("AMX"), "Amoxicillin") + expect_identical(ab_name("AMX", language = NULL), "Amoxicillin") expect_identical(as.character(ab_atc("AMX")), "J01CA04") expect_identical(ab_cid("AMX"), as.integer(33613)) expect_equal(class(ab_tradenames("AMX")), "character") expect_equal(class(ab_tradenames(c("AMX", "AMX"))), "list") - expect_identical(ab_group("AMX"), "Beta-lactams/penicillins") - expect_identical(ab_atc_group1("AMX"), "Beta-lactam antibacterials, penicillins") - expect_identical(ab_atc_group2("AMX"), "Penicillins with extended spectrum") + expect_identical(ab_group("AMX", language = NULL), "Beta-lactams/penicillins") + expect_identical(ab_atc_group1("AMX", language = NULL), "Beta-lactam antibacterials, penicillins") + expect_identical(ab_atc_group2("AMX", language = NULL), "Penicillins with extended spectrum") - expect_identical(ab_name("Fluclox"), "Flucloxacillin") - expect_identical(ab_name("fluklox"), "Flucloxacillin") - expect_identical(ab_name("floxapen"), "Flucloxacillin") - expect_identical(ab_name(21319), "Flucloxacillin") - expect_identical(ab_name("J01CF05"), "Flucloxacillin") + expect_identical(ab_name("Fluclox", language = NULL), "Flucloxacillin") + expect_identical(ab_name("fluklox", language = NULL), "Flucloxacillin") + expect_identical(ab_name("floxapen", language = NULL), "Flucloxacillin") + expect_identical(ab_name(21319, language = NULL), "Flucloxacillin") + expect_identical(ab_name("J01CF05", language = NULL), "Flucloxacillin") expect_identical(ab_ddd("AMX", "oral"), 1) expect_identical(ab_ddd("AMX", "oral", units = TRUE), "g") expect_identical(ab_ddd("AMX", "iv"), 1) expect_identical(ab_ddd("AMX", "iv", units = TRUE), "g") - expect_identical(ab_name(x = c("AMC", "PLB")), c("Amoxicillin/clavulanic acid", "Polymyxin B")) - expect_identical(ab_name(x = c("AMC", "PLB"), tolower = TRUE), + expect_identical(ab_name(x = c("AMC", "PLB"), language = NULL), c("Amoxicillin/clavulanic acid", "Polymyxin B")) + expect_identical(ab_name(x = c("AMC", "PLB"), tolower = TRUE, language = NULL), c("amoxicillin/clavulanic acid", "polymyxin B")) expect_equal(class(ab_info("AMX")), "list") diff --git a/vignettes/datasets.Rmd b/vignettes/datasets.Rmd index 63af4eba6..0605e83d9 100644 --- a/vignettes/datasets.Rmd +++ b/vignettes/datasets.Rmd @@ -3,7 +3,7 @@ title: "Data sets for download / own use" output: rmarkdown::html_vignette: toc: true - toc_depth: 2 + toc_depth: 1 vignette: > %\VignetteIndexEntry{Data sets for download / own use} %\VignetteEncoding{UTF-8} @@ -52,7 +52,7 @@ download_txt <- function(filename) { excel <- paste0(filename, ".xlsx") create_txt <- function(filename, type) { paste0('', - ' ', + '
', '') }