diff --git a/DESCRIPTION b/DESCRIPTION
index 1f5d7d95..fb309447 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: AMR
-Version: 1.6.0.9011
+Version: 1.6.0.9012
Date: 2021-04-27
Title: Antimicrobial Resistance Data Analysis
Authors@R: c(
diff --git a/NEWS.md b/NEWS.md
index dfec6e0a..b23286fd 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# AMR 1.6.0.9011
+# AMR 1.6.0.9012
## Last updated: 27 April 2021
### New
diff --git a/R/episode.R b/R/episode.R
index 6ff9576c..cfcd7998 100644
--- a/R/episode.R
+++ b/R/episode.R
@@ -88,7 +88,8 @@
#' # grouping on patients and microorganisms leads to the same results
#' # as first_isolate():
#' x <- example_isolates %>%
-#' filter_first_isolate(include_unknown = TRUE)
+#' filter_first_isolate(include_unknown = TRUE,
+#' method = "episode-based")
#'
#' y <- example_isolates %>%
#' group_by(patient_id, mo) %>%
diff --git a/data-raw/AMR_latest.tar.gz b/data-raw/AMR_latest.tar.gz
index 49d17501..3aeb6ccf 100644
Binary files a/data-raw/AMR_latest.tar.gz and b/data-raw/AMR_latest.tar.gz differ
diff --git a/docs/404.html b/docs/404.html
index 6b5c33d6..c79d709e 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -81,7 +81,7 @@
NEWS.md
-
custom_mdro_guideline()
function, please see mdro()
for additional infoggplot()
generics for classes <mic>
and <disk>
+ggplot()
generics for classes <mic>
and <disk>
Function mo_is_yeast()
, which determines whether a microorganism is a member of the taxonomic class Saccharomycetes or the taxonomic order Saccharomycetales:
translate
)plot()
and with ggplot2 using ggplot()
on any vector of MIC and disk diffusion valuesplot()
and with ggplot2 using ggplot()
on any vector of MIC and disk diffusion valuesmicroorganisms
data setis.rsi.eligible()
now detects if the column name resembles an antibiotic name or code and now returns TRUE
immediately if the input contains any of the values “R”, “S” or “I”. This drastically improves speed, also for a lot of other functions that rely on automatic determination of antibiotic columns.
get_episode()
and is_new_episode()
now support less than a day as value for argument episode_days
(e.g., to include one patient/test per hour)ampc_cephalosporin_resistance
in eucast_rules()
now also applies to value “I” (not only “S”)print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
+print()
and summary()
on a Principal Components Analysis object (pca()
) now print additional group info if the original data was grouped using dplyr::group_by()
guess_ab_col()
. As this also internally improves the reliability of first_isolate()
and mdro()
, this might have a slight impact on the results of those functions.mo_name()
when used in other languages than EnglishAMR
v0.5.0 and low
Making this package independent of especially the tidyverse (e.g. packages dplyr
and tidyr
) tremendously increases sustainability on the long term, since tidyverse functions change quite often. Good for users, but hard for package maintainers. Most of our functions are replaced with versions that only rely on base R, which keeps this package fully functional for many years to come, without requiring a lot of maintenance to keep up with other packages anymore. Another upside it that this package can now be used with all versions of R since R-3.0.0 (April 2013). Our package is being used in settings where the resources are very limited. Fewer dependencies on newer software is helpful for such settings.
freq()
that was borrowed from the cleaner
package was removed. Use cleaner::freq()
, or run library("cleaner")
before you use freq()
.freq()
that was borrowed from the cleaner
package was removed. Use cleaner::freq()
, or run library("cleaner")
before you use freq()
.mo
or rsi
in a tibble will no longer be in colour and printing rsi
in a tibble will show the class <ord>
, not <rsi>
anymore. This is purely a visual effect.mo_*
family (like mo_name()
and mo_gramstain()
) are noticeably slower when running on hundreds of thousands of rows.mo
and ab
now both also inherit class character
, to support any data transformation. This change invalidates code that checks for class length == 1.
#> Warning message:
#> invalid microorganism code, NA generated
"testvalue"
could never be understood by e.g. mo_name()
, although the class would suggest a valid microbial code.
-freq()
has moved to a new package, clean
(CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq()
function still works, since it is re-exported from the clean
package (which will be installed automatically upon updating this AMR
package).freq()
has moved to a new package, clean
(CRAN link), since creating frequency tables actually does not fit the scope of this package. The freq()
function still works, since it is re-exported from the clean
package (which will be installed automatically upon updating this AMR
package).Renamed data set septic_patients
to example_isolates
also_single_tested
w
age()
function gained a new argument exact
to determine ages with decimalsguess_mo()
, guess_atc()
, EUCAST_rules()
, interpretive_reading()
, rsi()
freq()
):
+freq()
):
also_single_tested
w
support for boxplots:
also_single_tested
w
age_groups()
, to let groups of fives and tens end with 100+ instead of 120+freq()
for when all values are NA
+freq()
for when all values are NA
first_isolate()
for when dates are missingguess_ab_col()
@@ -1590,7 +1590,7 @@ Using as.mo(..., allow_uncertain = 3)
freq()
function):
+freq()
function):
Support for tidyverse quasiquotation! Now you can create frequency tables of function outcomes:
@@ -1599,15 +1599,15 @@ Usingas.mo(..., allow_uncertain = 3)# OLD WAY
septic_patients %>%
mutate(genus = mo_genus(mo)) %>%
- freq(genus)
+ freq(genus)
# NEW WAY
septic_patients %>%
- freq(mo_genus(mo))
+ freq(mo_genus(mo))
# Even supports grouping variables:
septic_patients %>%
group_by(gender) %>%
- freq(mo_genus(mo))
header
functionheader
is now set to TRUE
at default, even for markdownas.mo(..., allow_uncertain = 3)Using portion_*
functions now throws a warning when total available isolate is below argument minimum
Functions as.mo
, as.rsi
, as.mic
, as.atc
and freq
will not set package name as attribute anymore
-Frequency tables - freq()
:
+ Frequency tables - freq()
:
-
Support for grouping variables, test with:
+ freq(gender)
-
Support for (un)selecting columns:
- Check for
hms::is.hms
@@ -1728,7 +1728,7 @@ Using as.mo(..., allow_uncertain = 3)Removed diacritics from all authors (columns microorganisms$ref
and microorganisms.old$ref
) to comply with CRAN policy to only allow ASCII characters
- Fix for
mo_property
not working properly
- Fix for
eucast_rules
where some Streptococci would become ceftazidime R in EUCAST rule 4.5
-- Support for named vectors of class
mo
, useful for top_freq()
+ - Support for named vectors of class
mo
, useful for top_freq()
-
ggplot_rsi
and scale_y_percent
have breaks
argument
@@ -1893,12 +1893,12 @@ Using as.mo(..., allow_uncertain = 3)Support for types (classes) list and matrix for freq
+freq(my_matrix)
For lists, subsetting is possible:
my_list = list(age = septic_patients$age, gender = septic_patients$gender)
-my_list %>% freq(age)
-my_list %>% freq(gender)
+my_list %>% freq(age)
+my_list %>% freq(gender)
@@ -1972,13 +1972,13 @@ Using as.mo(..., allow_uncertain = 3)
A vignette to explain its usage
Support for rsi
(antimicrobial resistance) to use as input
-Support for table
to use as input: freq(table(x, y))
+ Support for table
to use as input: freq(table(x, y))
Support for existing functions hist
and plot
to use a frequency table as input: hist(freq(df$age))
Support for as.vector
, as.data.frame
, as_tibble
and format
-Support for quasiquotation: freq(mydata, mycolumn)
is the same as mydata %>% freq(mycolumn)
+ Support for quasiquotation: freq(mydata, mycolumn)
is the same as mydata %>% freq(mycolumn)
Function top_freq
function to return the top/below n items as vector
Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index 8446a735..49087b51 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -12,7 +12,7 @@ articles:
datasets: datasets.html
resistance_predict: resistance_predict.html
welcome_to_AMR: welcome_to_AMR.html
-last_built: 2021-04-27T08:22Z
+last_built: 2021-04-27T09:08Z
urls:
reference: https://msberends.github.io/AMR//reference
article: https://msberends.github.io/AMR//articles
diff --git a/docs/reference/get_episode.html b/docs/reference/get_episode.html
index e9078bb1..8d4bfff6 100644
--- a/docs/reference/get_episode.html
+++ b/docs/reference/get_episode.html
@@ -82,7 +82,7 @@
@@ -337,7 +337,8 @@ The lifecycle of this function is stable# grouping on patients and microorganisms leads to the same results
# as first_isolate():
x <- example_isolates %>%
- filter_first_isolate(include_unknown = TRUE)
+ filter_first_isolate(include_unknown = TRUE,
+ method = "episode-based")
y <- example_isolates %>%
group_by(patient_id, mo) %>%
diff --git a/docs/reference/index.html b/docs/reference/index.html
index 0d6c456f..6d86117e 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -81,7 +81,7 @@
diff --git a/docs/survey.html b/docs/survey.html
index 1205a9b3..d17d3e5c 100644
--- a/docs/survey.html
+++ b/docs/survey.html
@@ -81,7 +81,7 @@
diff --git a/man/get_episode.Rd b/man/get_episode.Rd
index 379af4f6..93b39d4f 100644
--- a/man/get_episode.Rd
+++ b/man/get_episode.Rd
@@ -90,7 +90,8 @@ if (require("dplyr")) {
# grouping on patients and microorganisms leads to the same results
# as first_isolate():
x <- example_isolates \%>\%
- filter_first_isolate(include_unknown = TRUE)
+ filter_first_isolate(include_unknown = TRUE,
+ method = "episode-based")
y <- example_isolates \%>\%
group_by(patient_id, mo) \%>\%
diff --git a/tests/testthat/test-episode.R b/tests/testthat/test-episode.R
index f2250166..fc27b40c 100644
--- a/tests/testthat/test-episode.R
+++ b/tests/testthat/test-episode.R
@@ -47,7 +47,7 @@ test_that("episodes work", {
suppressMessages(
x <- example_isolates %>%
- mutate(out = first_isolate(., include_unknown = TRUE, info = FALSE))
+ mutate(out = first_isolate(., include_unknown = TRUE, method = "episode-based", info = FALSE))
)
y <- example_isolates %>%