From 3d3366faf7c909051671d83d78323c686f47ed52 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Mon, 4 Feb 2019 18:04:29 +0100 Subject: [PATCH] is.rsi.eligible update --- R/rsi.R | 2 +- docs/index.html | 30 ++--- docs/news/index.html | 255 ++++++++----------------------------- docs/pkgdown.yml | 2 +- docs/reference/as.rsi.html | 2 +- man/as.rsi.Rd | 2 +- 6 files changed, 71 insertions(+), 222 deletions(-) diff --git a/R/rsi.R b/R/rsi.R index e3e7b0f0..7f8f4fc7 100755 --- a/R/rsi.R +++ b/R/rsi.R @@ -57,7 +57,7 @@ #' #' # default threshold of `is.rsi.eligible` is 5%. #' is.rsi.eligible(WHONET$`First name`) # fails, >80% is invalid -#' is.rsi.eligible(WHONET$`First name`, threhold = 0.9) # succeeds +#' is.rsi.eligible(WHONET$`First name`, threshold = 0.9) # succeeds as.rsi <- function(x) { if (is.rsi(x)) { x diff --git a/docs/index.html b/docs/index.html index 5f829e0d..c983f82d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -238,15 +238,15 @@

Latest released version

This package is available on the official R network (CRAN), which has a peer-reviewed submission process. Install this package in R with:

-
install.packages("AMR")
+
install.packages("AMR")

It will be downloaded and installed automatically. For RStudio, click on the menu Tools > Install Packages… and then type in “AMR” and press Install.

Latest development version

The latest and unpublished development version can be installed with (precaution: may be unstable):

-
install.packages("devtools")
-devtools::install_gitlab("msberends/AMR")
+
install.packages("devtools")
+devtools::install_gitlab("msberends/AMR")
@@ -286,17 +286,17 @@ Overview of functions

The AMR package basically does four important things:

    -
  1. -

    It cleanses existing data by providing new classes for microoganisms, antibiotics and antimicrobial results (both S/I/R and MIC). By installing this package, you teach R everything about microbiology that is needed for analysis. These functions all use artificial intelligence to guess results that you would expect:

    +
  2. It cleanses existing data by providing new classes for microoganisms, antibiotics and antimicrobial results (both S/I/R and MIC). By installing this package, you teach R everything about microbiology that is needed for analysis. These functions all use artificial intelligence to guess results that you would expect:
  3. +
- -
  • -

    It enhances existing data and adds new data from data sets included in this package.

    +
      +
    1. It enhances existing data and adds new data from data sets included in this package.
    2. +
    -
  • -
  • -

    It analyses the data with convenient functions that use well-known methods.

    +
      +
    1. It analyses the data with convenient functions that use well-known methods.
    2. +
    -
  • -
  • -

    It teaches the user how to use all the above actions.

    +
      +
    1. It teaches the user how to use all the above actions.
    2. +
    • Aside from this website with many tutorials, the package itself contains extensive help pages with many examples for all functions.
    • It also contains an example data set called septic_patients. This data set contains: @@ -331,8 +331,6 @@
  • - -

    diff --git a/docs/news/index.html b/docs/news/index.html index 978dc238..43bbc4d9 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -236,28 +236,13 @@
    • BREAKING: removed deprecated functions, parameters and references to ‘bactid’. Use as.mo() to identify an MO code.
    • -
    • Support for data from WHONET and EARS-Net (European Antimicrobial Resistance Surveillance Network): -
        +
      • Support for data from WHONET and EARS-Net (European Antimicrobial Resistance Surveillance Network):
      • Exported files from WHONET can be read and used in this package. For functions like first_isolate() and eucast_rules(), all parameters will be filled in automatically.
      • This package now knows all antibiotic abbrevations by EARS-Net (which are also being used by WHONET) - the antibiotics data set now contains a column ears_net.
      • -
      -
    • -
    • -

      All ab_* functions are deprecated and replaced by atc_* functions:

      - -These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus.
    • -
    • New website: https://msberends.gitlab.io/AMR (built with the great pkgdown) -
        +
      • All ab_* functions are deprecated and replaced by atc_* functions: r ab_property -> atc_property() ab_name -> atc_name() ab_official -> atc_official() ab_trivial_nl -> atc_trivial_nl() ab_certe -> atc_certe() ab_umcg -> atc_umcg() ab_tradenames -> atc_tradenames() These functions use as.atc() internally. The old atc_property has been renamed atc_online_property(). This is done for two reasons: firstly, not all ATC codes are of antibiotics (ab) but can also be of antivirals or antifungals. Secondly, the input must have class atc or must be coerable to this class. Properties of these classes should start with the same class name, analogous to as.mo() and e.g. mo_genus.
      • +
      • New website: https://msberends.gitlab.io/AMR (built with the great pkgdown)
      • Contains the complete manual of this package and all of its functions with an explanation of their parameters
      • Contains a comprehensive tutorial about how to conduct antimicrobial resistance analysis
      • -
      -
    • New functions set_mo_source() and get_mo_source() to use your own predefined MO codes as input for as.mo() and consequently all mo_* functions
    • Support for the upcoming dplyr version 0.8.0
    • New function guess_ab_col() to find an antibiotic column in a table
    • @@ -265,24 +250,11 @@ These functions use as.atc()
    • New function mo_renamed() to get a list of all returned values from as.mo() that have had taxonomic renaming
    • New function age() to calculate the (patients) age in years
    • New function age_groups() to split ages into custom or predefined groups (like children or elderly). This allows for easier demographic antimicrobial resistance analysis per age group.
    • -
    • -

      New function ggplot_rsi_predict() as well as the base R plot() function can now be used for resistance prediction calculated with resistance_predict():

      -
      x <- resistance_predict(septic_patients, col_ab = "amox")
      -plot(x)
      -ggplot_rsi_predict(x)
      +
    • New function ggplot_rsi_predict() as well as the base R plot() function can now be used for resistance prediction calculated with resistance_predict(): r x <- resistance_predict(septic_patients, col_ab = "amox") plot(x) ggplot_rsi_predict(x)
    • -
    • -

      Functions filter_first_isolate() and filter_first_weighted_isolate() to shorten and fasten filtering on data sets with antimicrobial results, e.g.:

      - -

      is equal to:

      -
      septic_patients %>%
      -  mutate(only_firsts = first_isolate(septic_patients, ...)) %>%
      -  filter(only_firsts == TRUE) %>%
      -  select(-only_firsts)
      +
    • Functions filter_first_isolate() and filter_first_weighted_isolate() to shorten and fasten filtering on data sets with antimicrobial results, e.g.: r septic_patients %>% filter_first_isolate(...) # or filter_first_isolate(septic_patients, ...) is equal to: r septic_patients %>% mutate(only_firsts = first_isolate(septic_patients, ...)) %>% filter(only_firsts == TRUE) %>% select(-only_firsts)
    • -
    • New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the G-test and more. These are also available (and even easier readable) on our website: https://msberends.gitlab.io/AMR.

    • +
    • New vignettes about how to conduct AMR analysis, predict antimicrobial resistance, use the G-test and more. These are also available (and even easier readable) on our website: https://msberends.gitlab.io/AMR.

    @@ -294,16 +266,12 @@ These functions use as.atc()
  • Functions atc_ddd() and atc_groups() have been renamed atc_online_ddd() and atc_online_groups(). The old functions are deprecated and will be removed in a future version.
  • Function guess_mo() is now deprecated in favour of as.mo() and will be removed in future versions
  • Function guess_atc() is now deprecated in favour of as.atc() and will be removed in future versions
  • -
  • Function eucast_rules(): -
      +
    • Function eucast_rules():
    • Updated EUCAST Clinical breakpoints to version 9.0 of 1 January 2019
    • Fixed a critical bug where some rules that depend on previous applied rules would not be applied adequately
    • Emphasised in manual that penicillin is meant as benzylpenicillin (ATC J01CE01)
    • -
    -
  • -
  • Improvements for as.mo(): -
      +
    • Improvements for as.mo():
    • Fix for vector containing only empty values
    • Finds better results when input is in other languages
    • Better handling for subspecies
    • @@ -314,17 +282,12 @@ These functions use as.atc()
    • Progress bar will be shown when it takes more than 3 seconds to get results
    • Support for formatted console text
    • Console will return the percentage of uncoercable input
    • -
    -
  • -
  • Function first_isolate(): -
      +
    • Function first_isolate():
    • Fixed a bug where distances between dates would not be calculated right - in the septic_patients data set this yielded a difference of 0.15% more isolates
    • Will now use a column named like “patid” for the patient ID (parameter col_patientid), when this parameter was left blank
    • Will now use a column named like “key(…)ab” or “key(…)antibiotics” for the key antibiotics (parameter col_keyantibiotics()), when this parameter was left blank
    • Removed parameter output_logical, the function will now always return a logical value
    • Renamed parameter filter_specimen to specimen_group, although using filter_specimen will still work
    • -
    -
  • A note to the manual pages of the portion functions, that low counts can influence the outcome and that the portion functions may camouflage this, since they only return the portion (albeit being dependent on the minimum parameter)
  • Merged data sets microorganisms.certe and microorganisms.umcg into microorganisms.codes
  • @@ -336,23 +299,22 @@ These functions use as.atc()
  • Small text updates to summaries of class rsi and mic
  • -
  • Frequency tables (freq() function): - -
  • Function scale_y_percent() now contains the limits parameter
  • Automatic parameter filling for mdro(), key_antibiotics() and eucast_rules()
  • Updated examples for resistance prediction (resistance_predict() function)
  • -
  • Fix for as.mic() to support more values ending in (several) zeroes
  • +
  • Fix for as.mic() to support more values ending in (several) zeroes

  • @@ -408,8 +368,7 @@ These functions use as.atc()
  • EUCAST_rules was renamed to eucast_rules, the old function still exists as a deprecated function
  • -
  • Big changes to the eucast_rules function: -
      +
    • Big changes to the eucast_rules function:
    • Now also applies rules from the EUCAST ‘Breakpoint tables for bacteria’, version 8.1, 2018, http://www.eucast.org/clinical_breakpoints/ (see Source of the function)
    • New parameter rules to specify which rules should be applied (expert rules, breakpoints, others or all)
    • New parameter verbose which can be set to TRUE to get very specific messages about which columns and rows were affected
    • @@ -418,18 +377,11 @@ These functions use as.atc()
    • Data set septic_patients now reflects these changes
    • Added parameter pipe for piperacillin (J01CA12), also to the mdro function
    • Small fixes to EUCAST clinical breakpoint rules
    • -
    -
  • Added column kingdom to the microorganisms data set, and function mo_kingdom to look up values
  • Tremendous speed improvement for as.mo (and subsequently all mo_* functions), as empty values wil be ignored a priori
  • Fewer than 3 characters as input for as.mo will return NA
  • -
  • -

    Function as.mo (and all mo_* wrappers) now supports genus abbreviations with “species” attached

    -
    as.mo("E. species")        # B_ESCHR
    -mo_fullname("E. spp.")     # "Escherichia species"
    -as.mo("S. spp")            # B_STPHY
    -mo_fullname("S. species")  # "Staphylococcus species"
    +
  • Function as.mo (and all mo_* wrappers) now supports genus abbreviations with “species” attached r as.mo("E. species") # B_ESCHR mo_fullname("E. spp.") # "Escherichia species" as.mo("S. spp") # B_STPHY mo_fullname("S. species") # "Staphylococcus species"
  • Added parameter combine_IR (TRUE/FALSE) to functions portion_df and count_df, to indicate that all values of I and R must be merged into one, so the output only consists of S vs. IR (susceptible vs. non-susceptible)
  • Fix for portion_*(..., as_percent = TRUE) when minimal number of isolates would not be met
  • @@ -438,19 +390,18 @@ These functions use as.atc()
  • Using portion_* functions now throws a warning when total available isolate is below parameter minimum
  • Functions as.mo, as.rsi, as.mic, as.atc and freq will not set package name as attribute anymore
  • -
  • Frequency tables - freq(): - -
  • first_isolate now tries to find columns to use as input when parameters are left blank
  • Improvements for MDRO algorithm (function mdro)
  • @@ -474,8 +423,7 @@ These functions use as.atc()
  • ggplot_rsi and scale_y_percent have breaks parameter
  • -
  • AI improvements for as.mo: -
      +
    • AI improvements for as.mo:
    • "CRS" -> Stenotrophomonas maltophilia
    • @@ -488,8 +436,6 @@ These functions use as.atc()
    • "MSSE" -> Staphylococcus epidermidis
    • -
    -
  • Fix for join functions
  • Speed improvement for is.rsi.eligible, now 15-20 times faster
  • In g.test, when sum(x) is below 1000 or any of the expected values is below 5, Fisher’s Exact Test will be suggested
  • @@ -518,8 +464,7 @@ These functions use as.atc() New

    @@ -653,21 +534,15 @@ These functions use as.atc() New

    - -
  • Determining bacterial ID: -
      +
    • Determining bacterial ID:
    • New functions as.bactid and is.bactid to transform/ look up microbial ID’s.
    • The existing function guess_bactid is now an alias of as.bactid
    • New Becker classification for Staphylococcus to categorise them into Coagulase Negative Staphylococci (CoNS) and Coagulase Positve Staphylococci (CoPS)
    • New Lancefield classification for Streptococcus to categorise them into Lancefield groups
    • -
    -
  • For convience, new descriptive statistical functions kurtosis and skewness that are lacking in base R - they are generic functions and have support for vectors, data.frames and matrices
  • Function g.test to perform the Χ2 distributed G-test, which use is the same as chisq.test
  • -
  • -Function ratio to transform a vector of values to a preset ratio - -
  • Support for Addins menu in RStudio to quickly insert %in% or %like% (and give them keyboard shortcuts), or to view the datasets that come with this package
  • Function p.symbol to transform p values to their related symbols: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  • Functions clipboard_import and clipboard_export as helper functions to quickly copy and paste from/to software like Excel and SPSS. These functions use the clipr package, but are a little altered to also support headless Linux servers (so you can use it in RStudio Server)
  • -
  • New for frequency tables (function freq): -
      +
    • New for frequency tables (function freq):
    • 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)) @@ -718,8 +583,6 @@ These functions use as.atc()
    • Header of frequency tables now also show Mean Absolute Deviaton (MAD) and Interquartile Range (IQR)
    • Possibility to globally set the default for the amount of items to print, with options(max.print.freq = n) where n is your preset value
    -
  • -

    @@ -741,27 +604,21 @@ These functions use as.atc()
  • Small improvements to the microorganisms dataset (especially for Salmonella) and the column bactid now has the new class "bactid"
  • -
  • Combined MIC/RSI values will now be coerced by the rsi and mic functions: - -
  • Now possible to coerce MIC values with a space between operator and value, i.e. as.mic("<= 0.002") now works
  • Classes rsi and mic do not add the attribute package.version anymore
  • Added "groups" option for atc_property(..., property). It will return a vector of the ATC hierarchy as defined by the WHO. The new function atc_groups is a convenient wrapper around this.
  • Build-in host check for atc_property as it requires the host set by url to be responsive
  • Improved first_isolate algorithm to exclude isolates where bacteria ID or genus is unavailable
  • Fix for warning hybrid evaluation forced for row_number (924b62) from the dplyr package v0.7.5 and above
  • -
  • Support for empty values and for 1 or 2 columns as input for guess_bactid (now called as.bactid) -
      +
    • Support for empty values and for 1 or 2 columns as input for guess_bactid (now called as.bactid)
    • So yourdata %>% select(genus, species) %>% as.bactid() now also works
    • -
    -
  • Other small fixes
  • @@ -769,14 +626,11 @@ These functions use as.atc()

    Other

    @@ -795,13 +649,10 @@ These functions use as.atc()
  • Function guess_bactid to determine the ID of a microorganism based on genus/species or known abbreviations like MRSA
  • Function guess_atc to determine the ATC of an antibiotic based on name, trade name, or known abbreviations
  • Function freq to create frequency tables, with additional info in a header
  • -
  • Function MDRO to determine Multi Drug Resistant Organisms (MDRO) with support for country-specific guidelines. - -
  • New algorithm to determine weighted isolates, can now be "points" or "keyantibiotics", see ?first_isolate
  • New print format for tibbles and data.tables
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index ac0898dd..6102d6c7 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,4 +1,4 @@ -pandoc: 2.3.1 +pandoc: 1.17.2 pkgdown: 1.3.0 pkgdown_sha: ~ articles: diff --git a/docs/reference/as.rsi.html b/docs/reference/as.rsi.html index 2289ba8a..0e9a45aa 100644 --- a/docs/reference/as.rsi.html +++ b/docs/reference/as.rsi.html @@ -298,7 +298,7 @@ On our website https://msberends.gitla # default threshold of `is.rsi.eligible` is 5%. is.rsi.eligible(WHONET$`First name`) # fails, >80% is invalid -is.rsi.eligible(WHONET$`First name`, threhold = 0.9) # succeeds +is.rsi.eligible(WHONET$`First name`, threshold = 0.9) # succeeds # }