diff --git a/DESCRIPTION b/DESCRIPTION index 0628f431..4373a40d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: AMR -Version: 1.3.0.9038 +Version: 1.3.0.9039 Date: 2020-10-04 Title: Antimicrobial Resistance Analysis Authors@R: c( diff --git a/NEWS.md b/NEWS.md index 3f1fea42..bbbd5870 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,5 @@ -# AMR 1.3.0.9038 -## Last updated: 4 October 2020 +# AMR 1.3.0.9039 +## Last updated: 4 October 2020 Note: some changes in this version were suggested by anonymous reviewers from the journal we submitted our manuscipt about this package to. We are those reviewers very grateful for going through our code so thoroughly! @@ -65,6 +65,7 @@ Note: some changes in this version were suggested by anonymous reviewers from th * 'Penicillin V' (for oral use, code `PNV`) was removed, since its actual entry 'Phenoxymethylpenicillin' (code `PHN`) already existed * The group name (`antibiotics$group`) of 'Linezolid' (`LNZ`), 'Cycloserine' (`CYC`), 'Tedizolid' (`TZD`) and 'Thiacetazone' (`THA`) is now "Oxazolidinones" instead of "Other antibacterials" * Added support for using `unique()` on classes ``, ``, ``, `` and `` +* Added parameter `excess` to the `kurtosis()` function (defaults to `FALSE`), to return the *excess kurtosis*, defined as the kurtosis minus three. ### Other * Removed functions `portion_R()`, `portion_S()` and `portion_I()` that were deprecated since version 0.9.0 (November 2019) and were replaced with `proportion_R()`, `proportion_S()` and `proportion_I()` diff --git a/R/ab.R b/R/ab.R index 2129f64b..9078b203 100755 --- a/R/ab.R +++ b/R/ab.R @@ -22,7 +22,7 @@ #' Transform input to an antibiotic ID #' #' Use this function to determine the antibiotic code of one or more antibiotics. The data set [antibiotics] will be searched for abbreviations, official names and synonyms (brand names). -#' @inheritSection lifecycle Maturing lifecycle +#' @inheritSection lifecycle Stable lifecycle #' @param x character vector to determine to antibiotic ID #' @param flag_multiple_results logical to indicate whether a note should be printed to the console that probably more than one antibiotic code or name can be retrieved from a single input value. #' @param info logical to indicate whether a progress bar should be printed diff --git a/R/guess_ab_col.R b/R/guess_ab_col.R index f26e0074..0ece22c7 100755 --- a/R/guess_ab_col.R +++ b/R/guess_ab_col.R @@ -22,7 +22,7 @@ #' Guess antibiotic column #' #' This tries to find a column name in a data set based on information from the [antibiotics] data set. Also supports WHONET abbreviations. -#' @inheritSection lifecycle Maturing lifecycle +#' @inheritSection lifecycle Stable lifecycle #' @param x a [data.frame] #' @param search_string a text to search `x` for, will be checked with [as.ab()] if this value is not a column in `x` #' @param verbose a logical to indicate whether additional info should be printed diff --git a/R/kurtosis.R b/R/kurtosis.R index 16673aaf..485adcb3 100755 --- a/R/kurtosis.R +++ b/R/kurtosis.R @@ -21,41 +21,43 @@ #' Kurtosis of the sample #' -#' @description Kurtosis is a measure of the "tailedness" of the probability distribution of a real-valued random variable. -#' @inheritSection lifecycle Questioning lifecycle +#' @description Kurtosis is a measure of the "tailedness" of the probability distribution of a real-valued random variable. A normal distribution has a kurtosis of 3 and a excess kurtosis of 0. +#' @inheritSection lifecycle Stable lifecycle #' @param x a vector of values, a [`matrix`] or a [data.frame] -#' @param na.rm a logical value indicating whether `NA` values should be stripped before the computation proceeds. +#' @param na.rm a logical to indicate whether `NA` values should be stripped before the computation proceeds +#' @param excess a logical to indicate whether the *excess kurtosis* should be returned, defined as the kurtosis minus 3. #' @seealso [skewness()] #' @rdname kurtosis #' @inheritSection AMR Read more on our website! #' @export -kurtosis <- function(x, na.rm = FALSE) { +kurtosis <- function(x, na.rm = FALSE, excess = FALSE) { UseMethod("kurtosis") } #' @method kurtosis default #' @rdname kurtosis #' @export -kurtosis.default <- function(x, na.rm = FALSE) { +kurtosis.default <- function(x, na.rm = FALSE, excess = FALSE) { x <- as.vector(x) if (na.rm == TRUE) { x <- x[!is.na(x)] } n <- length(x) - n * sum((x - mean(x, na.rm = na.rm))^4, na.rm = na.rm) / + k <- n * sum((x - mean(x, na.rm = na.rm))^4, na.rm = na.rm) / (sum((x - mean(x, na.rm = na.rm))^2, na.rm = na.rm)^2) + k - ifelse(excess, 3, 0) } #' @method kurtosis matrix #' @rdname kurtosis #' @export -kurtosis.matrix <- function(x, na.rm = FALSE) { - apply(x, 2, kurtosis.default, na.rm = na.rm) +kurtosis.matrix <- function(x, na.rm = FALSE, excess = FALSE) { + apply(x, 2, kurtosis.default, na.rm = na.rm, excess = excess) } #' @method kurtosis data.frame #' @rdname kurtosis #' @export -kurtosis.data.frame <- function(x, na.rm = FALSE) { - sapply(x, kurtosis.default, na.rm = na.rm) +kurtosis.data.frame <- function(x, na.rm = FALSE, excess = FALSE) { + sapply(x, kurtosis.default, na.rm = na.rm, excess = excess) } diff --git a/R/mdro.R b/R/mdro.R index 67422507..ccf9823a 100755 --- a/R/mdro.R +++ b/R/mdro.R @@ -22,7 +22,7 @@ #' Determine multidrug-resistant organisms (MDRO) #' #' Determine which isolates are multidrug-resistant organisms (MDRO) according to international and national guidelines. -#' @inheritSection lifecycle Maturing lifecycle +#' @inheritSection lifecycle Stable lifecycle #' @param guideline a specific guideline to follow. When left empty, the publication by Magiorakos *et al.* (2012, Clinical Microbiology and Infection) will be followed, please see *Details*. #' @inheritParams eucast_rules #' @param pct_required_classes minimal required percentage of antimicrobial classes that must be available per isolate, rounded down. For example, with the default guideline, 17 antimicrobial classes must be available for *S. aureus*. Setting this `pct_required_classes` argument to `0.5` (default) means that for every *S. aureus* isolate at least 8 different classes must be available. Any lower number of available classes will return `NA` for that isolate. diff --git a/R/skewness.R b/R/skewness.R index 2ba2b6d8..735071eb 100755 --- a/R/skewness.R +++ b/R/skewness.R @@ -23,10 +23,10 @@ #' #' @description Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. #' -#' When negative: the left tail is longer; the mass of the distribution is concentrated on the right of the figure. When positive: the right tail is longer; the mass of the distribution is concentrated on the left of the figure. -#' @inheritSection lifecycle Questioning lifecycle +#' When negative ('left-skewed'): the left tail is longer; the mass of the distribution is concentrated on the right of a histogram. When positive ('right-skewed'): the right tail is longer; the mass of the distribution is concentrated on the left of a histogram. A normal distribution has a skewness of 0. +#' @inheritSection lifecycle Stable lifecycle #' @param x a vector of values, a [`matrix`] or a [data.frame] -#' @param na.rm a logical value indicating whether `NA` values should be stripped before the computation proceeds. +#' @param na.rm a logical value indicating whether `NA` values should be stripped before the computation proceeds #' @seealso [kurtosis()] #' @rdname skewness #' @inheritSection AMR Read more on our website! diff --git a/docs/404.html b/docs/404.html index c6a48106..42f0e181 100644 --- a/docs/404.html +++ b/docs/404.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 9493e22d..a2f3913a 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/docs/articles/EUCAST.html b/docs/articles/EUCAST.html index 3f190efd..f2d8dffe 100644 --- a/docs/articles/EUCAST.html +++ b/docs/articles/EUCAST.html @@ -39,7 +39,7 @@ AMR (for R) - 1.4.0 + 1.3.0.9039 diff --git a/docs/articles/index.html b/docs/articles/index.html index 7a4455eb..7e90191e 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/docs/authors.html b/docs/authors.html index 395aa0c5..533d364d 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/docs/index.html b/docs/index.html index be673880..95e27d8f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -43,7 +43,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/docs/news/index.html b/docs/news/index.html index bb0e76d0..9579a502 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 @@ -236,9 +236,9 @@ Source: NEWS.md -
-

-AMR 1.3.0.9038 Unreleased +
+

+AMR 1.3.0.9039 Unreleased

@@ -331,6 +331,7 @@
  • Added support for using unique() on classes <rsi>, <mic>, <disk>, <ab> and <mo>

  • +
  • Added parameter excess to the kurtosis() function (defaults to FALSE), to return the excess kurtosis, defined as the kurtosis minus three.

  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index c6fd28ac..2db08a13 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 2.7.3 pkgdown: 1.5.1.9000 pkgdown_sha: eae56f08694abebf93cdfc0dd8e9ede06d8c815f articles: [] -last_built: 2020-10-04T17:22Z +last_built: 2020-10-04T19:01Z urls: reference: https://msberends.github.io/AMR/reference article: https://msberends.github.io/AMR/articles diff --git a/docs/reference/as.ab.html b/docs/reference/as.ab.html index c7b48d78..991ea349 100644 --- a/docs/reference/as.ab.html +++ b/docs/reference/as.ab.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0 + 1.3.0.9039
    @@ -288,12 +288,13 @@

    World Health Organization (WHO) Collaborating Centre for Drug Statistics Methodology: https://www.whocc.no/atc_ddd_index/

    WHONET 2019 software: http://www.whonet.org/software.html

    European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: http://ec.europa.eu/health/documents/community-register/html/atc.htm

    -

    Maturing lifecycle

    +

    Stable lifecycle

    -


    -The lifecycle of this function is maturing. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome to suggest changes at our repository or write us an email (see section 'Contact Us').

    +


    +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.

    WHOCC

    diff --git a/docs/reference/eucast_rules.html b/docs/reference/eucast_rules.html index 9e1dbcb0..45b0a7f1 100644 --- a/docs/reference/eucast_rules.html +++ b/docs/reference/eucast_rules.html @@ -83,7 +83,7 @@ To improve the interpretation of the antibiogram before EUCAST rules are applied AMR (for R) - 1.3.0.9038 + 1.3.0.9039
    diff --git a/docs/reference/guess_ab_col.html b/docs/reference/guess_ab_col.html index a194b9f8..ba5d0b37 100644 --- a/docs/reference/guess_ab_col.html +++ b/docs/reference/guess_ab_col.html @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0 + 1.3.0.9039

    @@ -267,12 +267,13 @@

    Details

    You can look for an antibiotic (trade) name or abbreviation and it will search x and the antibiotics data set for any column containing a name or code of that antibiotic. Longer columns names take precendence over shorter column names.

    -

    Maturing lifecycle

    +

    Stable lifecycle

    -


    -The lifecycle of this function is maturing. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome to suggest changes at our repository or write us an email (see section 'Contact Us').

    +


    +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.

    Read more on our website!

    diff --git a/docs/reference/index.html b/docs/reference/index.html index 7c44d380..d4418bee 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/docs/reference/kurtosis.html b/docs/reference/kurtosis.html index ec1c3964..05cf8edd 100644 --- a/docs/reference/kurtosis.html +++ b/docs/reference/kurtosis.html @@ -49,7 +49,7 @@ - + @@ -82,7 +82,7 @@ AMR (for R) - 1.4.0 + 1.3.0.9039 @@ -239,19 +239,19 @@
    -

    Kurtosis is a measure of the "tailedness" of the probability distribution of a real-valued random variable.

    +

    Kurtosis is a measure of the "tailedness" of the probability distribution of a real-valued random variable. A normal distribution has a kurtosis of 3 and a excess kurtosis of 0.

    -
    kurtosis(x, na.rm = FALSE)
    +    
    kurtosis(x, na.rm = FALSE, excess = FALSE)
     
     # S3 method for default
    -kurtosis(x, na.rm = FALSE)
    +kurtosis(x, na.rm = FALSE, excess = FALSE)
     
     # S3 method for matrix
    -kurtosis(x, na.rm = FALSE)
    +kurtosis(x, na.rm = FALSE, excess = FALSE)
     
     # S3 method for data.frame
    -kurtosis(x, na.rm = FALSE)
    +kurtosis(x, na.rm = FALSE, excess = FALSE)

    Arguments

    @@ -262,16 +262,21 @@ - + + + + +
    na.rm

    a logical value indicating whether NA values should be stripped before the computation proceeds.

    a logical to indicate whether NA values should be stripped before the computation proceeds

    excess

    a logical to indicate whether the excess kurtosis should be returned, defined as the kurtosis minus 3.

    -

    Questioning lifecycle

    +

    Stable lifecycle

    -


    -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.

    Read more on our website!

    diff --git a/docs/reference/mdro.html b/docs/reference/mdro.html index 54ff23f0..0efabc20 100644 --- a/docs/reference/mdro.html +++ b/docs/reference/mdro.html @@ -82,7 +82,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 @@ -337,12 +337,13 @@ The Dutch national guideline - Rijksinstituut voor Volksgezondheid en Milieu "WI

    Please suggest your own (country-specific) guidelines by letting us know: https://github.com/msberends/AMR/issues/new.

    Note: Every test that involves the Enterobacteriaceae family, will internally be performed using its newly named order Enterobacterales, since the Enterobacteriaceae family has been taxonomically reclassified by Adeolu et al. in 2016. Before that, Enterobacteriaceae was the only family under the Enterobacteriales (with an i) order. All species under the old Enterobacteriaceae family are still under the new Enterobacterales (without an i) order, but divided into multiple families. The way tests are performed now by this mdro() function makes sure that results from before 2016 and after 2016 are identical.

    -

    Maturing lifecycle

    +

    Stable lifecycle

    -


    -The lifecycle of this function is maturing. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome to suggest changes at our repository or write us an email (see section 'Contact Us').

    +


    +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.

    Antibiotics

    diff --git a/docs/reference/mo_source.html b/docs/reference/mo_source.html index 563bdfec..e99d9ef1 100644 --- a/docs/reference/mo_source.html +++ b/docs/reference/mo_source.html @@ -83,7 +83,7 @@ This is the fastest way to have your organisation (or analysis) specific codes p AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/docs/reference/skewness.html b/docs/reference/skewness.html index 95236a5e..19545132 100644 --- a/docs/reference/skewness.html +++ b/docs/reference/skewness.html @@ -50,7 +50,7 @@ +When negative ('left-skewed'): the left tail is longer; the mass of the distribution is concentrated on the right of a histogram. When positive ('right-skewed'): the right tail is longer; the mass of the distribution is concentrated on the left of a histogram. A normal distribution has a skewness of 0." /> @@ -83,7 +83,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr AMR (for R) - 1.4.0 + 1.3.0.9039 @@ -241,7 +241,7 @@ When negative: the left tail is longer; the mass of the distribution is concentr

    Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean.

    -

    When negative: the left tail is longer; the mass of the distribution is concentrated on the right of the figure. When positive: the right tail is longer; the mass of the distribution is concentrated on the left of the figure.

    +

    When negative ('left-skewed'): the left tail is longer; the mass of the distribution is concentrated on the right of a histogram. When positive ('right-skewed'): the right tail is longer; the mass of the distribution is concentrated on the left of a histogram. A normal distribution has a skewness of 0.

    skewness(x, na.rm = FALSE)
    @@ -264,16 +264,17 @@ When negative: the left tail is longer; the mass of the distribution is concentr
         
         
           na.rm
    -      

    a logical value indicating whether NA values should be stripped before the computation proceeds.

    +

    a logical value indicating whether NA values should be stripped before the computation proceeds

    -

    Questioning lifecycle

    +

    Stable lifecycle

    -


    -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.

    Read more on our website!

    diff --git a/docs/survey.html b/docs/survey.html index 02a307e6..097fcff8 100644 --- a/docs/survey.html +++ b/docs/survey.html @@ -81,7 +81,7 @@ AMR (for R) - 1.3.0.9038 + 1.3.0.9039 diff --git a/man/as.ab.Rd b/man/as.ab.Rd index 1b1a6bb6..4c43ab8c 100644 --- a/man/as.ab.Rd +++ b/man/as.ab.Rd @@ -47,10 +47,12 @@ WHONET 2019 software: \url{http://www.whonet.org/software.html} European Commission Public Health PHARMACEUTICALS - COMMUNITY REGISTER: \url{http://ec.europa.eu/health/documents/community-register/html/atc.htm} } -\section{Maturing lifecycle}{ +\section{Stable lifecycle}{ -\if{html}{\figure{lifecycle_maturing.svg}{options: style=margin-bottom:5px} \cr} -The \link[=lifecycle]{lifecycle} of this function is \strong{maturing}. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome \href{https://github.com/msberends/AMR/issues}{to suggest changes at our repository} or \link[=AMR]{write us an email (see section 'Contact Us')}. +\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{WHOCC}{ diff --git a/man/guess_ab_col.Rd b/man/guess_ab_col.Rd index 87c56739..25e933ea 100644 --- a/man/guess_ab_col.Rd +++ b/man/guess_ab_col.Rd @@ -22,10 +22,12 @@ This tries to find a column name in a data set based on information from the \li \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.} } -\section{Maturing lifecycle}{ +\section{Stable lifecycle}{ -\if{html}{\figure{lifecycle_maturing.svg}{options: style=margin-bottom:5px} \cr} -The \link[=lifecycle]{lifecycle} of this function is \strong{maturing}. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome \href{https://github.com/msberends/AMR/issues}{to suggest changes at our repository} or \link[=AMR]{write us an email (see section 'Contact Us')}. +\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/kurtosis.Rd b/man/kurtosis.Rd index 60328e5d..c95be194 100644 --- a/man/kurtosis.Rd +++ b/man/kurtosis.Rd @@ -7,26 +7,30 @@ \alias{kurtosis.data.frame} \title{Kurtosis of the sample} \usage{ -kurtosis(x, na.rm = FALSE) +kurtosis(x, na.rm = FALSE, excess = FALSE) -\method{kurtosis}{default}(x, na.rm = FALSE) +\method{kurtosis}{default}(x, na.rm = FALSE, excess = FALSE) -\method{kurtosis}{matrix}(x, na.rm = FALSE) +\method{kurtosis}{matrix}(x, na.rm = FALSE, excess = FALSE) -\method{kurtosis}{data.frame}(x, na.rm = FALSE) +\method{kurtosis}{data.frame}(x, na.rm = FALSE, excess = FALSE) } \arguments{ \item{x}{a vector of values, a \code{\link{matrix}} or a \link{data.frame}} -\item{na.rm}{a logical value indicating whether \code{NA} values should be stripped before the computation proceeds.} +\item{na.rm}{a logical to indicate whether \code{NA} values should be stripped before the computation proceeds} + +\item{excess}{a logical to indicate whether the \emph{excess kurtosis} should be returned, defined as the kurtosis minus 3.} } \description{ -Kurtosis is a measure of the "tailedness" of the probability distribution of a real-valued random variable. +Kurtosis is a measure of the "tailedness" of the probability distribution of a real-valued random variable. A normal distribution has a kurtosis of 3 and a excess kurtosis of 0. } -\section{Questioning lifecycle}{ +\section{Stable 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. +\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/mdro.Rd b/man/mdro.Rd index 1d2500af..a2988590 100644 --- a/man/mdro.Rd +++ b/man/mdro.Rd @@ -94,10 +94,12 @@ Please suggest your own (country-specific) guidelines by letting us know: \url{h \strong{Note:} Every test that involves the Enterobacteriaceae family, will internally be performed using its newly named \emph{order} Enterobacterales, since the Enterobacteriaceae family has been taxonomically reclassified by Adeolu \emph{et al.} in 2016. Before that, Enterobacteriaceae was the only family under the Enterobacteriales (with an i) order. All species under the old Enterobacteriaceae family are still under the new Enterobacterales (without an i) order, but divided into multiple families. The way tests are performed now by this \code{\link[=mdro]{mdro()}} function makes sure that results from before 2016 and after 2016 are identical. } -\section{Maturing lifecycle}{ +\section{Stable lifecycle}{ -\if{html}{\figure{lifecycle_maturing.svg}{options: style=margin-bottom:5px} \cr} -The \link[=lifecycle]{lifecycle} of this function is \strong{maturing}. The unlying code of a maturing function has been roughed out, but finer details might still change. Since this function needs wider usage and more extensive testing, you are very welcome \href{https://github.com/msberends/AMR/issues}{to suggest changes at our repository} or \link[=AMR]{write us an email (see section 'Contact Us')}. +\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{Antibiotics}{ diff --git a/man/skewness.Rd b/man/skewness.Rd index 08c0b077..b4d2a6f8 100644 --- a/man/skewness.Rd +++ b/man/skewness.Rd @@ -18,17 +18,19 @@ skewness(x, na.rm = FALSE) \arguments{ \item{x}{a vector of values, a \code{\link{matrix}} or a \link{data.frame}} -\item{na.rm}{a logical value indicating whether \code{NA} values should be stripped before the computation proceeds.} +\item{na.rm}{a logical value indicating whether \code{NA} values should be stripped before the computation proceeds} } \description{ Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. -When negative: the left tail is longer; the mass of the distribution is concentrated on the right of the figure. When positive: the right tail is longer; the mass of the distribution is concentrated on the left of the figure. +When negative ('left-skewed'): the left tail is longer; the mass of the distribution is concentrated on the right of a histogram. When positive ('right-skewed'): the right tail is longer; the mass of the distribution is concentrated on the left of a histogram. A normal distribution has a skewness of 0. } -\section{Questioning lifecycle}{ +\section{Stable 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. +\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/tests/testthat/test-kurtosis.R b/tests/testthat/test-kurtosis.R index ebf824ca..ca12b3e2 100644 --- a/tests/testthat/test-kurtosis.R +++ b/tests/testthat/test-kurtosis.R @@ -26,10 +26,18 @@ test_that("kurtosis works", { expect_equal(kurtosis(example_isolates$age), 3.549319, tolerance = 0.00001) + expect_equal(unname(kurtosis(data.frame(example_isolates$age))), 3.549319, tolerance = 0.00001) + expect_equal(unname(kurtosis(data.frame(example_isolates$age), excess = TRUE)), + 0.549319, + tolerance = 0.00001) + expect_equal(kurtosis(matrix(example_isolates$age)), 3.549319, tolerance = 0.00001) + expect_equal(kurtosis(matrix(example_isolates$age), excess = TRUE), + 0.549319, + tolerance = 0.00001) })