diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 4d6d4f59..e712a216 100755 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -12,6 +12,8 @@ on: name: R-CMD-check +permissions: read-all + jobs: R-CMD-check: runs-on: ${{ matrix.config.os }} @@ -28,12 +30,12 @@ jobs: # use 4.1 to check with rtools40's older compiler - {os: windows-latest, r: '4.1'} - - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel-1'} - - {os: ubuntu-latest, r: 'oldrel-2'} - - {os: ubuntu-latest, r: 'oldrel-3'} - - {os: ubuntu-latest, r: 'oldrel-4'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + - {os: ubuntu-latest, r: 'oldrel-2'} + - {os: ubuntu-latest, r: 'oldrel-3'} + - {os: ubuntu-latest, r: 'oldrel-4'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index a7276e85..c9f0165d 100755 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -11,6 +11,8 @@ on: name: pkgdown +permissions: read-all + jobs: pkgdown: runs-on: ubuntu-latest diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index eea58c5c..d1f76509 100755 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -6,6 +6,8 @@ on: name: Commands +permissions: read-all + jobs: document: if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 21b8a933..fefc52e2 100755 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -8,6 +8,8 @@ on: name: test-coverage +permissions: read-all + jobs: test-coverage: runs-on: ubuntu-latest @@ -23,18 +25,27 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::covr + extra-packages: any::covr, any::xml2 needs: coverage - name: Test coverage run: | - covr::codecov( + cov <- covr::package_coverage( quiet = FALSE, clean = FALSE, install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") ) + covr::to_cobertura(cov) shell: Rscript {0} + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} + file: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + - name: Show testthat output if: always() run: | diff --git a/DESCRIPTION b/DESCRIPTION index b93dd7d2..4abcd14a 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,11 +27,10 @@ URL: https://github.com/alexpghayes/distributions3, https://alexpghayes.github.io/distributions3/ BugReports: https://github.com/alexpghayes/distributions3/issues Imports: - ellipsis, ggplot2, - glue + glue, + rlang Suggests: - covr, cowplot, knitr, PoissonBinomial, diff --git a/NAMESPACE b/NAMESPACE index 0dd49917..656b6052 100755 --- a/NAMESPACE +++ b/NAMESPACE @@ -516,6 +516,7 @@ export(support) export(variance) import(stats) importFrom(glue,glue) +importFrom(rlang,.data) importFrom(stats,dnbinom) importFrom(stats,dpois) importFrom(stats,pnbinom) diff --git a/R/Bernoulli.R b/R/Bernoulli.R index dea70023..b62b196a 100755 --- a/R/Bernoulli.R +++ b/R/Bernoulli.R @@ -94,7 +94,7 @@ Bernoulli <- function(p = 0.5) { #' @export mean.Bernoulli <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(x$p, names(x)) } @@ -281,7 +281,7 @@ suff_stat.Bernoulli <- function(d, x, ...) { #' #' @export support.Bernoulli <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(1, length(d)) make_support(min, max, d, drop = drop) @@ -289,12 +289,12 @@ support.Bernoulli <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Bernoulli <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.Bernoulli <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/Beta.R b/R/Beta.R index 09cbdbbd..8b1d3c03 100755 --- a/R/Beta.R +++ b/R/Beta.R @@ -45,7 +45,7 @@ Beta <- function(alpha = 1, beta = 1) { #' @export mean.Beta <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$alpha / (x$alpha + x$beta) setNames(rval, names(x)) } @@ -208,7 +208,7 @@ quantile.Beta <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Beta <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(1, length(d)) make_support(min, max, d, drop = drop) @@ -216,12 +216,12 @@ support.Beta <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Beta <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Beta <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Binomial.R b/R/Binomial.R index 4afc917a..647a8d26 100755 --- a/R/Binomial.R +++ b/R/Binomial.R @@ -103,7 +103,7 @@ Binomial <- function(size, p = 0.5) { #' @export mean.Binomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$size * x$p setNames(rval, names(x)) } @@ -300,7 +300,7 @@ suff_stat.Binomial <- function(d, x, ...) { #' #' @export support.Binomial <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- d$size make_support(min, max, d, drop = drop) @@ -308,12 +308,12 @@ support.Binomial <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Binomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.Binomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/Categorical.R b/R/Categorical.R index 7c8471f5..9ec1a2d5 100755 --- a/R/Categorical.R +++ b/R/Categorical.R @@ -167,7 +167,7 @@ cdf.Categorical <- function(d, x, ...) { #' @export #' quantile.Categorical <- function(x, probs, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() if (!is.numeric(x$outcomes)) { stop( "The sample space of `x` must be numeric to evaluate quantiles.", @@ -190,12 +190,12 @@ quantile.Categorical <- function(x, probs, ...) { #' @exportS3Method is_discrete.Categorical <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.Categorical <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/Cauchy.R b/R/Cauchy.R index f920cf77..488bb682 100755 --- a/R/Cauchy.R +++ b/R/Cauchy.R @@ -86,7 +86,7 @@ Cauchy <- function(location = 0, scale = 1) { #' @export mean.Cauchy <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- rep(NaN, length(x)) setNames(rval, names(x)) } @@ -240,7 +240,7 @@ quantile.Cauchy <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Cauchy <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(-Inf, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -248,12 +248,12 @@ support.Cauchy <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Cauchy <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Cauchy <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/ChiSquare.R b/R/ChiSquare.R index d4bce0d1..586c3ff2 100755 --- a/R/ChiSquare.R +++ b/R/ChiSquare.R @@ -101,7 +101,7 @@ ChiSquare <- function(df) { #' @export mean.ChiSquare <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$df setNames(rval, names(x)) } @@ -259,7 +259,7 @@ quantile.ChiSquare <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.ChiSquare <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -267,12 +267,12 @@ support.ChiSquare <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.ChiSquare <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.ChiSquare <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Erlang.R b/R/Erlang.R index d2b8e183..2c32f1f9 100755 --- a/R/Erlang.R +++ b/R/Erlang.R @@ -175,7 +175,7 @@ quantile.Erlang <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Erlang <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -183,12 +183,12 @@ support.Erlang <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Erlang <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Erlang <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Exponential.R b/R/Exponential.R index 84483d14..aa96f626 100755 --- a/R/Exponential.R +++ b/R/Exponential.R @@ -78,7 +78,7 @@ Exponential <- function(rate = 1) { #' @export mean.Exponential <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$rate^-1 setNames(rval, names(x)) } @@ -265,7 +265,7 @@ suff_stat.Exponential <- function(d, x, ...) { #' #' @export support.Exponential <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -273,12 +273,12 @@ support.Exponential <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Exponential <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Exponential <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/FisherF.R b/R/FisherF.R index 1beb2993..c4d07c19 100755 --- a/R/FisherF.R +++ b/R/FisherF.R @@ -51,7 +51,7 @@ FisherF <- function(df1, df2, lambda = 0) { #' @export mean.FisherF <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() # The k-th moment of an F(df1, df2) distribution exists and # is finite only when 2k < d2 @@ -236,7 +236,7 @@ quantile.FisherF <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.FisherF <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -244,12 +244,12 @@ support.FisherF <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.FisherF <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.FisherF <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Frechet.R b/R/Frechet.R index aabfd48b..dc44a02a 100755 --- a/R/Frechet.R +++ b/R/Frechet.R @@ -93,7 +93,7 @@ Frechet <- function(location = 0, scale = 1, shape = 1) { #' @export mean.Frechet <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() a <- x$shape m <- x$location s <- x$scale @@ -320,7 +320,7 @@ quantile.Frechet <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Frechet <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- d$location max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -328,12 +328,12 @@ support.Frechet <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Frechet <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Frechet <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Gamma.R b/R/Gamma.R index 2f077486..9891e34d 100755 --- a/R/Gamma.R +++ b/R/Gamma.R @@ -91,7 +91,7 @@ Gamma <- function(shape, rate = 1) { #' @export mean.Gamma <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$shape / x$rate setNames(rval, names(x)) } @@ -271,7 +271,7 @@ suff_stat.Gamma <- function(d, x, ...) { #' #' @export support.Gamma <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -279,12 +279,12 @@ support.Gamma <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Gamma <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Gamma <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/GeneralisedExtremeValue.R b/R/GeneralisedExtremeValue.R index 32f18984..8982a577 100755 --- a/R/GeneralisedExtremeValue.R +++ b/R/GeneralisedExtremeValue.R @@ -122,7 +122,7 @@ g <- function(d, k) gamma(1 - k * d$xi) #' @export mean.GEV <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() euler <- -digamma(1) rval <- ifelse(x$xi == 0, x$mu + x$sigma * euler, @@ -321,7 +321,7 @@ quantile.GEV <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.GEV <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(-Inf, length(d)) min[d$xi > 0] <- d$mu[d$xi > 0] - d$sigma[d$xi > 0]/d$xi[d$xi > 0] max <- rep(Inf, length(d)) @@ -331,12 +331,12 @@ support.GEV <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.GEV <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.GEV <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/GeneralisedPareto.R b/R/GeneralisedPareto.R index c37121f3..b24815cb 100755 --- a/R/GeneralisedPareto.R +++ b/R/GeneralisedPareto.R @@ -112,7 +112,7 @@ GP <- function(mu = 0, sigma = 1, xi = 0) { #' @export mean.GP <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() mu <- x$mu sigma <- x$sigma xi <- x$xi @@ -296,7 +296,7 @@ quantile.GP <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.GP <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- d$mu max <- rep(Inf, length(d)) max[d$xi < 0] <- d$mu[d$xi < 0] - d$sigma[d$xi < 0]/d$xi[d$xi < 0] @@ -305,12 +305,12 @@ support.GP <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.GP <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.GP <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Geometric.R b/R/Geometric.R index 0ef02a41..553391d8 100755 --- a/R/Geometric.R +++ b/R/Geometric.R @@ -72,7 +72,7 @@ Geometric <- function(p = 0.5) { #' @export mean.Geometric <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- 1 / x$p setNames(rval, names(x)) } @@ -273,7 +273,7 @@ suff_stat.Geometric <- function(d, x, ...) { #' #' @export support.Geometric <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -282,12 +282,12 @@ support.Geometric <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Geometric <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.Geometric <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/Gumbel.R b/R/Gumbel.R index 62f60e1d..1567e161 100755 --- a/R/Gumbel.R +++ b/R/Gumbel.R @@ -80,7 +80,7 @@ Gumbel <- function(mu = 0, sigma = 1) { #' @export mean.Gumbel <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$mu + x$sigma * -digamma(1) setNames(rval, names(x)) } @@ -238,7 +238,7 @@ quantile.Gumbel <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Gumbel <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(-Inf, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -246,12 +246,12 @@ support.Gumbel <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Gumbel <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Gumbel <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/HurdleNegativeBinomial.R b/R/HurdleNegativeBinomial.R index dcc83eb9..d6ed269d 100755 --- a/R/HurdleNegativeBinomial.R +++ b/R/HurdleNegativeBinomial.R @@ -190,14 +190,14 @@ HurdleNegativeBinomial <- function(mu, theta, pi) { #' @export mean.HurdleNegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$mu * x$pi / pnbinom(0, size = x$theta, mu = x$mu, lower.tail = FALSE) setNames(rval, names(x)) } #' @export variance.HurdleNegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() m <- x$mu * x$pi / pnbinom(0, size = x$theta, mu = x$mu, lower.tail = FALSE) rval <- m * (1 + x$mu/x$theta + x$mu - m) setNames(rval, names(x)) @@ -206,7 +206,7 @@ variance.HurdleNegativeBinomial <- function(x, ...) { #' @export skewness.HurdleNegativeBinomial <- function(x, ...) { stop("not implemented yet") - ellipsis::check_dots_used() + rlang::check_dots_used() f <- x$pi / pnbinom(0, size = x$theta, mu = x$mu, lower.tail = FALSE) m <- x$mu * f s <- sqrt(m * (1 + x$mu/x$theta + x$mu - m)) @@ -218,7 +218,7 @@ skewness.HurdleNegativeBinomial <- function(x, ...) { #' @export kurtosis.HurdleNegativeBinomial <- function(x, ...) { stop("not implemented yet") - ellipsis::check_dots_used() + rlang::check_dots_used() f <- x$pi / (1 - exp(-x$mu)) m <- x$mu * f s2 <- m * (x$mu + 1 - m) @@ -359,7 +359,7 @@ quantile.HurdleNegativeBinomial <- function(x, probs, drop = TRUE, elementwise = #' #' @export support.HurdleNegativeBinomial <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -367,13 +367,13 @@ support.HurdleNegativeBinomial <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.HurdleNegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.HurdleNegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/HurdlePoisson.R b/R/HurdlePoisson.R index 02074a23..fafc5ee5 100755 --- a/R/HurdlePoisson.R +++ b/R/HurdlePoisson.R @@ -183,14 +183,14 @@ HurdlePoisson <- function(lambda, pi) { #' @export mean.HurdlePoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$lambda * x$pi / (1 - exp(-x$lambda)) setNames(rval, names(x)) } #' @export variance.HurdlePoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() m <- x$lambda * x$pi / (1 - exp(-x$lambda)) rval <- m * (x$lambda + 1 - m) setNames(rval, names(x)) @@ -198,7 +198,7 @@ variance.HurdlePoisson <- function(x, ...) { #' @export skewness.HurdlePoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() f <- x$pi / (1 - exp(-x$lambda)) m <- x$lambda * f s <- sqrt(m * (x$lambda + 1 - m)) @@ -208,7 +208,7 @@ skewness.HurdlePoisson <- function(x, ...) { #' @export kurtosis.HurdlePoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() f <- x$pi / (1 - exp(-x$lambda)) m <- x$lambda * f s2 <- m * (x$lambda + 1 - m) @@ -348,7 +348,7 @@ quantile.HurdlePoisson <- function(x, probs, drop = TRUE, elementwise = NULL, .. #' #' @export support.HurdlePoisson <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -356,13 +356,13 @@ support.HurdlePoisson <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.HurdlePoisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.HurdlePoisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/HyperGeometric.R b/R/HyperGeometric.R index 8aa3ec6f..a057eba2 100755 --- a/R/HyperGeometric.R +++ b/R/HyperGeometric.R @@ -107,7 +107,7 @@ HyperGeometric <- function(m, n, k) { #' @export mean.HyperGeometric <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() # Reformulating to match Wikipedia # N is the population size N <- x$n + x$m @@ -297,7 +297,7 @@ quantile.HyperGeometric <- function(x, probs, drop = TRUE, elementwise = NULL, . #' #' @export support.HyperGeometric <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- apply(cbind(0, d$k - d$n), 1, max) max <- apply(as.matrix(d)[, c("m", "k"), drop = FALSE], 1, min) make_support(min, max, d, drop = drop) @@ -305,12 +305,12 @@ support.HyperGeometric <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.HyperGeometric <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.HyperGeometric <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/LogNormal.R b/R/LogNormal.R index eda673b2..ddc040d8 100755 --- a/R/LogNormal.R +++ b/R/LogNormal.R @@ -71,7 +71,7 @@ LogNormal <- function(log_mu = 0, log_sigma = 1) { #' @export mean.LogNormal <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() mu <- x$log_mu sigma <- x$log_sigma rval <- exp(mu + sigma^2 / 2) @@ -277,7 +277,7 @@ suff_stat.LogNormal <- function(d, x, ...) { #' #' @export support.LogNormal <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -285,12 +285,12 @@ support.LogNormal <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.LogNormal <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.LogNormal <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Logistic.R b/R/Logistic.R index 5e612117..367164b3 100755 --- a/R/Logistic.R +++ b/R/Logistic.R @@ -83,7 +83,7 @@ Logistic <- function(location = 0, scale = 1) { #' @export mean.Logistic <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$location setNames(rval, names(x)) } @@ -246,7 +246,7 @@ quantile.Logistic <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Logistic <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(-Inf, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -254,12 +254,12 @@ support.Logistic <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Logistic <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Logistic <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Multinomial.R b/R/Multinomial.R index 0038ba1b..4857a793 100755 --- a/R/Multinomial.R +++ b/R/Multinomial.R @@ -96,7 +96,7 @@ print.Multinomial <- function(x, ...) { #' @export mean.Multinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() x$size * x$p } @@ -152,12 +152,12 @@ log_pdf.Multinomial <- function(d, x, ...) { #' @exportS3Method is_discrete.Multinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.Multinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/NegativeBinomial.R b/R/NegativeBinomial.R index 9ec450a1..9ef5f31b 100755 --- a/R/NegativeBinomial.R +++ b/R/NegativeBinomial.R @@ -110,7 +110,7 @@ NegativeBinomial <- function(size, p = 0.5, mu = size) { #' @export mean.NegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- if("mu" %in% names(unclass(x))) { x$mu } else { @@ -121,7 +121,7 @@ mean.NegativeBinomial <- function(x, ...) { #' @export variance.NegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- if("mu" %in% names(unclass(x))) { x$mu + 1/x$size * x$mu^2 } else { @@ -132,7 +132,7 @@ variance.NegativeBinomial <- function(x, ...) { #' @export skewness.NegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() if("mu" %in% names(unclass(x))) x$p <- x$size/(x$size + x$mu) rval <- (2 - x$p) / sqrt((1 - x$p) * x$size) setNames(rval, names(x)) @@ -140,7 +140,7 @@ skewness.NegativeBinomial <- function(x, ...) { #' @export kurtosis.NegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() if("mu" %in% names(unclass(x))) x$p <- x$size/(x$size + x$mu) rval <- 6 / x$size + x$p^2 / x$size * (1 - x$p) setNames(rval, names(x)) @@ -307,7 +307,7 @@ quantile.NegativeBinomial <- function(x, probs, drop = TRUE, elementwise = NULL, #' #' @export support.NegativeBinomial <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -315,12 +315,12 @@ support.NegativeBinomial <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.NegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.NegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/Normal.R b/R/Normal.R index 5137608f..562269f5 100755 --- a/R/Normal.R +++ b/R/Normal.R @@ -168,7 +168,7 @@ Normal <- function(mu = 0, sigma = 1) { #' @export mean.Normal <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(x$mu, names(x)) } @@ -378,7 +378,7 @@ suff_stat.Normal <- function(d, x, ...) { #' #' @export support.Normal <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(-Inf, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -386,12 +386,12 @@ support.Normal <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Normal <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Normal <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Poisson.R b/R/Poisson.R index fc66125b..5cbd07a1 100755 --- a/R/Poisson.R +++ b/R/Poisson.R @@ -76,28 +76,28 @@ Poisson <- function(lambda) { #' @export mean.Poisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$lambda setNames(rval, names(x)) } #' @export variance.Poisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$lambda setNames(rval, names(x)) } #' @export skewness.Poisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- 1 / sqrt(x$lambda) setNames(rval, names(x)) } #' @export kurtosis.Poisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- 1 / x$lambda setNames(rval, names(x)) } @@ -267,7 +267,7 @@ suff_stat.Poisson <- function(d, x, ...) { #' #' @export support.Poisson <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -275,12 +275,12 @@ support.Poisson <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Poisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.Poisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/PoissonBinomial.R b/R/PoissonBinomial.R index 55d219df..74377e69 100644 --- a/R/PoissonBinomial.R +++ b/R/PoissonBinomial.R @@ -429,7 +429,7 @@ quantile.PoissonBinomial <- function(x, probs, drop = TRUE, elementwise = NULL, #' #' @export support.PoissonBinomial <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep.int(0L, length(d)) p <- d class(p) <- "data.frame" @@ -440,12 +440,12 @@ support.PoissonBinomial <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.PoissonBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.PoissonBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/ReversedWeibull.R b/R/ReversedWeibull.R index e50322ac..b6c7302b 100755 --- a/R/ReversedWeibull.R +++ b/R/ReversedWeibull.R @@ -97,7 +97,7 @@ RevWeibull <- function(location = 0, scale = 1, shape = 1) { #' @export mean.RevWeibull <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$location + x$scale * gamma(1 + 1 / x$shape) setNames(rval, names(x)) } @@ -271,7 +271,7 @@ quantile.RevWeibull <- function(x, probs, drop = TRUE, elementwise = NULL, ...) #' #' @export support.RevWeibull <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(-Inf, length(d)) max <- d$location make_support(min, max, d, drop = drop) @@ -279,12 +279,12 @@ support.RevWeibull <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.RevWeibull <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.RevWeibull <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/StudentsT.R b/R/StudentsT.R index b201865b..6daec7d0 100755 --- a/R/StudentsT.R +++ b/R/StudentsT.R @@ -120,7 +120,7 @@ StudentsT <- function(df) { #' @export mean.StudentsT <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- ifelse(x$df > 1, 0, NaN @@ -318,7 +318,7 @@ quantile.StudentsT <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.StudentsT <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(-Inf, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -326,12 +326,12 @@ support.StudentsT <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.StudentsT <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.StudentsT <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Tukey.R b/R/Tukey.R index 5f5e585f..d2b74910 100755 --- a/R/Tukey.R +++ b/R/Tukey.R @@ -145,7 +145,7 @@ quantile.Tukey <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Tukey <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -153,12 +153,12 @@ support.Tukey <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Tukey <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Tukey <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Uniform.R b/R/Uniform.R index bc0e71d1..5d9c05ce 100755 --- a/R/Uniform.R +++ b/R/Uniform.R @@ -43,7 +43,7 @@ Uniform <- function(a = 0, b = 1) { #' @export mean.Uniform <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- (x$a + x$b) / 2 setNames(rval, names(x)) } @@ -232,7 +232,7 @@ quantile.Uniform <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Uniform <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- d$a max <- d$b make_support(min, max, d, drop = drop) @@ -240,12 +240,12 @@ support.Uniform <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Uniform <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Uniform <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/Weibull.R b/R/Weibull.R index 45487fc2..4fa4c988 100755 --- a/R/Weibull.R +++ b/R/Weibull.R @@ -68,7 +68,7 @@ Weibull <- function(shape, scale) { #' @export mean.Weibull <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- x$scale * gamma(1 + 1 / x$shape) setNames(rval, names(x)) } @@ -239,7 +239,7 @@ quantile.Weibull <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.Weibull <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -247,12 +247,12 @@ support.Weibull <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.Weibull <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } #' @exportS3Method is_continuous.Weibull <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } diff --git a/R/ZINegativeBinomial.R b/R/ZINegativeBinomial.R index 1bd8a3f7..59c7ef8e 100755 --- a/R/ZINegativeBinomial.R +++ b/R/ZINegativeBinomial.R @@ -176,14 +176,14 @@ ZINegativeBinomial <- function(mu, theta, pi) { #' @export mean.ZINegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- (1 - x$pi) * x$mu setNames(rval, names(x)) } #' @export variance.ZINegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- (1 - x$pi) * x$mu * (1 + (x$pi + 1/x$theta) * x$mu) setNames(rval, names(x)) } @@ -191,7 +191,7 @@ variance.ZINegativeBinomial <- function(x, ...) { #' @export skewness.ZINegativeBinomial <- function(x, ...) { stop("not yet implemented") - ellipsis::check_dots_used() + rlang::check_dots_used() ## FIXME: skewness of ZIPoisson m <- (1 - x$pi) * x$mu s <- sqrt(m * (1 + x$pi * x$mu)) @@ -202,7 +202,7 @@ skewness.ZINegativeBinomial <- function(x, ...) { #' @export kurtosis.ZINegativeBinomial <- function(x, ...) { stop("not yet implemented") - ellipsis::check_dots_used() + rlang::check_dots_used() ## FIXME: kurtosis of ZIPoisson rval <- ( (1 + 7 * x$mu + 6 * x$mu^2 + x$mu^3) - 4 * (1 - x$pi) * (x$mu + 3 * x$mu^2 + x$mu^3) @@ -343,7 +343,7 @@ quantile.ZINegativeBinomial <- function(x, probs, drop = TRUE, elementwise = NUL #' #' @export support.ZINegativeBinomial <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -351,13 +351,13 @@ support.ZINegativeBinomial <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.ZINegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.ZINegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/ZIPoisson.R b/R/ZIPoisson.R index dc72246f..44418162 100755 --- a/R/ZIPoisson.R +++ b/R/ZIPoisson.R @@ -169,21 +169,21 @@ ZIPoisson <- function(lambda, pi) { #' @export mean.ZIPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- (1 - x$pi) * x$lambda setNames(rval, names(x)) } #' @export variance.ZIPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- (1 - x$pi) * x$lambda * (1 + x$pi * x$lambda) setNames(rval, names(x)) } #' @export skewness.ZIPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() m <- (1 - x$pi) * x$lambda s <- sqrt(m * (1 + x$pi * x$lambda)) rval <- ((1 - x$pi) * (x$lambda + 3 * x$lambda^2 + x$lambda^3) - 3 * m * s^2 - m^3) / s^3 @@ -192,7 +192,7 @@ skewness.ZIPoisson <- function(x, ...) { #' @export kurtosis.ZIPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() rval <- ( (1 + 7 * x$lambda + 6 * x$lambda^2 + x$lambda^3) - 4 * (1 - x$pi) * (x$lambda + 3 * x$lambda^2 + x$lambda^3) + 6 * (1 - x$pi)^2 * (x$lambda^2 + x$lambda^3) @@ -332,7 +332,7 @@ quantile.ZIPoisson <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.ZIPoisson <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(0, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -340,13 +340,13 @@ support.ZIPoisson <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.ZIPoisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.ZIPoisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/ZTNegativeBinomial.R b/R/ZTNegativeBinomial.R index 4e3878b7..7b476bc0 100755 --- a/R/ZTNegativeBinomial.R +++ b/R/ZTNegativeBinomial.R @@ -178,7 +178,7 @@ ZTNegativeBinomial <- function(mu, theta) { #' @export mean.ZTNegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() m <- x$mu / pnbinom(0, mu = x$mu, size = x$theta, lower.tail = FALSE) m[x$mu <= 0] <- 1 setNames(m, names(x)) @@ -186,7 +186,7 @@ mean.ZTNegativeBinomial <- function(x, ...) { #' @export variance.ZTNegativeBinomial <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() m <- x$mu / pnbinom(0, mu = x$mu, size = x$theta, lower.tail = FALSE) m[x$mu <= 0] <- 1 v <- m * (x$mu/x$theta + x$mu + 1 - m) @@ -196,7 +196,7 @@ variance.ZTNegativeBinomial <- function(x, ...) { #' @export skewness.ZTNegativeBinomial <- function(x, ...) { stop("not implemented yet") - ellipsis::check_dots_used() + rlang::check_dots_used() f <- 1 / pnbinom(0, mu = x$mu, size = x$theta, lower.tail = FALSE) m <- x$mu * f s <- sqrt(m * (x$mu/x$theta + x$mu + 1 - m)) @@ -209,7 +209,7 @@ skewness.ZTNegativeBinomial <- function(x, ...) { #' @export kurtosis.ZTNegativeBinomial <- function(x, ...) { stop("not implemented yet") - ellipsis::check_dots_used() + rlang::check_dots_used() f <- 1 / pnbinom(0, mu = x$mu, size = x$theta, lower.tail = FALSE) m <- x$mu * f s2 <- m * (x$mu/x$theta + x$mu + 1 - m) @@ -351,7 +351,7 @@ quantile.ZTNegativeBinomial <- function(x, probs, drop = TRUE, elementwise = NUL #' #' @export support.ZTNegativeBinomial <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(1, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -359,13 +359,13 @@ support.ZTNegativeBinomial <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.ZTNegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.ZTNegativeBinomial <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/ZTPoisson.R b/R/ZTPoisson.R index 18157951..b7f249e5 100755 --- a/R/ZTPoisson.R +++ b/R/ZTPoisson.R @@ -170,7 +170,7 @@ ZTPoisson <- function(lambda) { #' @export mean.ZTPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() m <- x$lambda/ppois(0, lambda = x$lambda, lower.tail = FALSE) m[x$lambda <= 0] <- 1 setNames(m, names(x)) @@ -178,7 +178,7 @@ mean.ZTPoisson <- function(x, ...) { #' @export variance.ZTPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() m <- x$lambda/ppois(0, lambda = x$lambda, lower.tail = FALSE) m[x$lambda <= 0] <- 1 setNames(m * (1 + x$lambda - m), names(x)) @@ -186,7 +186,7 @@ variance.ZTPoisson <- function(x, ...) { #' @export skewness.ZTPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() f <- 1 / ppois(0, lambda = x$lambda, lower.tail = FALSE) m <- x$lambda * f s <- sqrt(m * (x$lambda + 1 - m)) @@ -197,7 +197,7 @@ skewness.ZTPoisson <- function(x, ...) { #' @export kurtosis.ZTPoisson <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() f <- 1 / ppois(0, lambda = x$lambda, lower.tail = FALSE) m <- x$lambda * f s2 <- m * (x$lambda + 1 - m) @@ -338,7 +338,7 @@ quantile.ZTPoisson <- function(x, probs, drop = TRUE, elementwise = NULL, ...) { #' #' @export support.ZTPoisson <- function(d, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() min <- rep(1, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) @@ -346,13 +346,13 @@ support.ZTPoisson <- function(d, drop = TRUE, ...) { #' @exportS3Method is_discrete.ZTPoisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(TRUE, length(d)), names(d)) } #' @exportS3Method is_continuous.ZTPoisson <- function(d, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(rep.int(FALSE, length(d)), names(d)) } diff --git a/R/distributions_package.R b/R/distributions3-package.R old mode 100755 new mode 100644 similarity index 54% rename from R/distributions_package.R rename to R/distributions3-package.R index e4cf7bb5..4bcd2a3a --- a/R/distributions_package.R +++ b/R/distributions3-package.R @@ -1,12 +1,9 @@ #' @keywords internal -#' -#' @import stats -#' @importFrom glue glue -#' "_PACKAGE" -# The following block is used by usethis to automatically manage -# roxygen namespace tags. Modify with care! ## usethis namespace: start +#' @importFrom rlang .data +#' @import stats +#' @importFrom glue glue ## usethis namespace: end NULL diff --git a/R/methods.R b/R/methods.R index ec6f2cd2..f69d0482 100755 --- a/R/methods.R +++ b/R/methods.R @@ -1,5 +1,5 @@ # things to sort out with the generics -# - can i get stats::generics() to use ellipsis::check_dots_used()? +# - can i get stats::generics() to use rlang::check_dots_used()? # - pdf() conflict with grDevices::pdf() #' Draw a random sample from a probability distribution @@ -40,7 +40,7 @@ #' random(X, 10) #' @export random <- function(x, n = 1L, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("random") } @@ -98,14 +98,14 @@ simulate.distribution <- function(object, nsim = 1L, seed = NULL, ...) { #' log_pdf(X, c(1, 2, 3, 4, 5)) #' @export pdf <- function(d, x, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("pdf") } #' @rdname pdf #' @export log_pdf <- function(d, x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("log_pdf") } @@ -137,7 +137,7 @@ pmf <- function(d, x, ...) { #' cdf(X, c(1, 2, 3, 4, 5)) #' @export cdf <- function(d, x, drop = TRUE, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("cdf") } @@ -166,21 +166,21 @@ cdf <- function(d, x, drop = TRUE, ...) { #' @export #' variance <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("variance") } #' @rdname variance #' @export skewness <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("skewness") } #' @rdname variance #' @export kurtosis <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("kurtosis") } @@ -232,7 +232,7 @@ likelihood <- function(d, x, ...) { #' fit_mle(X, c(-1, 0, 0, 0, 3)) #' @export fit_mle <- function(d, x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("fit_mle") } @@ -250,7 +250,7 @@ fit_mle <- function(d, x, ...) { #' suff_stat(X, c(-1, 0, 0, 0, 3)) #' @export suff_stat <- function(d, x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() UseMethod("suff_stat") } diff --git a/R/plot.R b/R/plot.R index 5a8e3560..312c2ca7 100755 --- a/R/plot.R +++ b/R/plot.R @@ -423,7 +423,7 @@ plot_cdf <- function(d, limits = NULL, p = 0.001, ## actual plot out_plot <- ggplot2::ggplot( data = plot_df, - ggplot2::aes_string(x = "x", y = "y") + ggplot2::aes(x = .data$x, y = .data$y) ) + ggplot2::geom_bar( stat = "identity", @@ -462,7 +462,7 @@ plot_cdf <- function(d, limits = NULL, p = 0.001, ## actual plot out_plot <- ggplot2::ggplot( data = plot_df, - ggplot2::aes_string(x = "x", y = "y") + ggplot2::aes(x = .data$x, y = .data$y) ) + ggplot2::geom_line() + ggplot2::facet_grid(group ~ .) + @@ -546,7 +546,7 @@ plot_pdf <- function(d, limits = NULL, p = 0.001, ## actual plot out_plot <- ggplot2::ggplot( data = plot_df, - ggplot2::aes_string(x = "x", y = "y") + ggplot2::aes(x = .data$x, y = .data$y) ) + ggplot2::geom_bar( stat = "identity", @@ -585,7 +585,7 @@ plot_pdf <- function(d, limits = NULL, p = 0.001, ## actual plot out_plot <- ggplot2::ggplot( data = plot_df, - ggplot2::aes_string(x = "x", y = "y") + ggplot2::aes(x = .data$x, y = .data$y) ) + ggplot2::geom_line() + ggplot2::facet_grid(group ~ .) + diff --git a/R/utils.R b/R/utils.R index 32e7330e..86c1e2a7 100755 --- a/R/utils.R +++ b/R/utils.R @@ -83,7 +83,7 @@ is_distribution <- function(x) { #' ## mean(), variance(), skewness(), kurtosis(). #' ## These can be typically be defined as functions of the list of parameters. #' mean.Gaussian <- function(x, ...) { -#' ellipsis::check_dots_used() +#' rlang::check_dots_used() #' setNames(x$mu, names(x)) #' } #' ## Analogously for other moments, see distributions3:::variance.Normal etc. diff --git a/man/apply_dpqr.Rd b/man/apply_dpqr.Rd index de0ea68a..bee76b6f 100755 --- a/man/apply_dpqr.Rd +++ b/man/apply_dpqr.Rd @@ -82,7 +82,7 @@ as.matrix(Y) ## mean(), variance(), skewness(), kurtosis(). ## These can be typically be defined as functions of the list of parameters. mean.Gaussian <- function(x, ...) { - ellipsis::check_dots_used() + rlang::check_dots_used() setNames(x$mu, names(x)) } ## Analogously for other moments, see distributions3:::variance.Normal etc. diff --git a/man/distributions3-package.Rd b/man/distributions3-package.Rd index 81da0a14..a00251ff 100755 --- a/man/distributions3-package.Rd +++ b/man/distributions3-package.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/distributions_package.R +% Please edit documentation in R/distributions3-package.R \docType{package} \name{distributions3-package} \alias{distributions3} diff --git a/tests/testthat/test-Bernoulli.R b/tests/testthat/test-Bernoulli.R index eef6c31d..2955cd10 100755 --- a/tests/testthat/test-Bernoulli.R +++ b/tests/testthat/test-Bernoulli.R @@ -1,5 +1,3 @@ -context("test-Bernoulli") - test_that("print.Bernoulli works", { expect_output(print(Bernoulli()), regexp = "Bernoulli") }) diff --git a/tests/testthat/test-Beta.R b/tests/testthat/test-Beta.R index c764b00a..c34297bf 100755 --- a/tests/testthat/test-Beta.R +++ b/tests/testthat/test-Beta.R @@ -1,5 +1,3 @@ -context("test-Beta") - test_that("print.Beta works", { expect_output(print(Beta()), regexp = "Beta") }) diff --git a/tests/testthat/test-Binomial.R b/tests/testthat/test-Binomial.R index d728c821..569c2b1f 100755 --- a/tests/testthat/test-Binomial.R +++ b/tests/testthat/test-Binomial.R @@ -1,5 +1,3 @@ -context("test-Binomial") - test_that("print.Binomial works", { expect_output(print(Binomial(1)), regexp = "Binomial") }) diff --git a/tests/testthat/test-Categorical.R b/tests/testthat/test-Categorical.R index d15e3607..86a3f72f 100755 --- a/tests/testthat/test-Categorical.R +++ b/tests/testthat/test-Categorical.R @@ -1,5 +1,3 @@ -context("test-Categorical") - test_that("print.Categorical", { X <- Categorical(1:6) Y <- Categorical(LETTERS[1:3], p = c(0.1, 0.2, 0.7)) diff --git a/tests/testthat/test-Cauchy.R b/tests/testthat/test-Cauchy.R index 489dae51..d9ba7b7e 100755 --- a/tests/testthat/test-Cauchy.R +++ b/tests/testthat/test-Cauchy.R @@ -1,5 +1,3 @@ -context("test-Cauchy") - test_that("print.Cauchy works", { expect_output(print(Cauchy(1, 1)), regexp = "Cauchy") }) @@ -23,7 +21,7 @@ test_that("random.Cauchy work correctly", { expect_length(random(cau[-1], 1), 0) expect_length(random(cau, 0), 0) expect_error(random(cau, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(cau, c(1, 2, 3)), 3) expect_length(random(cau, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Erlang.R b/tests/testthat/test-Erlang.R index 5b4b6e90..c663e32f 100755 --- a/tests/testthat/test-Erlang.R +++ b/tests/testthat/test-Erlang.R @@ -2,8 +2,6 @@ # # The Erlang distribution is a special case of the gamma distribution wherein # the shape (k) of the distribution is discretised. - -context("test-Erlang") e <- Erlang(k = 3, lambda = 0.5) test_that("Erlang constructor works", { @@ -26,7 +24,7 @@ test_that("random.Erlang works correctly", { expect_length(random(e[-1], 1), 0) expect_length(random(e, 0), 0) expect_error(random(e, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(e, c(1, 2, 3)), 3) expect_length(random(e, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Exponential.R b/tests/testthat/test-Exponential.R index 7facb622..aece22b7 100755 --- a/tests/testthat/test-Exponential.R +++ b/tests/testthat/test-Exponential.R @@ -1,5 +1,3 @@ -context("test-Exponential") - test_that("fit_mle.Exponential works correctly", { expect_equal(fit_mle(Exponential(), 1), Exponential(1)) @@ -20,7 +18,7 @@ test_that("random.Exponential work correctly", { expect_length(random(e[-1], 1), 0) expect_length(random(e, 0), 0) expect_error(random(e, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(e, c(1, 2, 3)), 3) expect_length(random(e, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-FisherF.R b/tests/testthat/test-FisherF.R index ad0bb289..b68fecba 100755 --- a/tests/testthat/test-FisherF.R +++ b/tests/testthat/test-FisherF.R @@ -1,5 +1,3 @@ -context("test-FisherF") - test_that("print.FisherF works", { expect_output(print(FisherF(1, 1)), regexp = "FisherF") }) @@ -23,7 +21,7 @@ test_that("random.FisherF work correctly", { expect_length(random(s[-1], 1), 0) expect_length(random(s, 0), 0) expect_error(random(s, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(s, c(1, 2, 3)), 3) expect_length(random(s, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Frechet.R b/tests/testthat/test-Frechet.R index ffecd493..7a4a34e8 100755 --- a/tests/testthat/test-Frechet.R +++ b/tests/testthat/test-Frechet.R @@ -1,5 +1,3 @@ -context("test-Frechet") - test_that("print.Frechet works", { expect_output(print(Frechet()), regexp = "Frechet") }) @@ -35,7 +33,7 @@ test_that("random.Frechet works correctly", { expect_length(random(g1[-1], 1), 0) expect_length(random(g1, 0), 0) expect_error(random(g1, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g1, c(1, 2, 3)), 3) expect_length(random(g1, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Gamma.R b/tests/testthat/test-Gamma.R index 77e5e1dd..efbef80f 100755 --- a/tests/testthat/test-Gamma.R +++ b/tests/testthat/test-Gamma.R @@ -1,5 +1,3 @@ -context("test-Gamma") - test_that("print.Gamma works", { expect_output(print(Gamma(1, 1)), regexp = "Gamma") }) @@ -23,7 +21,7 @@ test_that("random.Gamma work correctly", { expect_length(random(cau[-1], 1), 0) expect_length(random(cau, 0), 0) expect_error(random(cau, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(cau, c(1, 2, 3)), 3) expect_length(random(cau, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-GeneralisedExtremeValue.R b/tests/testthat/test-GeneralisedExtremeValue.R index 524a8a92..e72afe6f 100755 --- a/tests/testthat/test-GeneralisedExtremeValue.R +++ b/tests/testthat/test-GeneralisedExtremeValue.R @@ -1,5 +1,3 @@ -context("test-GEV") - test_that("print.GEV works", { expect_output(print(GEV()), regexp = "GEV") }) @@ -36,7 +34,7 @@ test_that("random.GEV works correctly", { expect_length(random(g1[-1], 1), 0) expect_length(random(g1, 0), 0) expect_error(random(g1, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g1, c(1, 2, 3)), 3) expect_length(random(g1, cbind(1, 2, 3)), 3) @@ -47,7 +45,7 @@ test_that("random.GEV works correctly", { expect_length(random(g2[-1], 1), 0) expect_length(random(g2, 0), 0) expect_error(random(g2, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g2, c(1, 2, 3)), 3) expect_length(random(g2, cbind(1, 2, 3)), 3) @@ -58,7 +56,7 @@ test_that("random.GEV works correctly", { expect_length(random(g3[-1], 1), 0) expect_length(random(g3, 0), 0) expect_error(random(g3, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g3, c(1, 2, 3)), 3) expect_length(random(g3, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-GeneralisedPareto.R b/tests/testthat/test-GeneralisedPareto.R index 47892d68..e11c4d50 100755 --- a/tests/testthat/test-GeneralisedPareto.R +++ b/tests/testthat/test-GeneralisedPareto.R @@ -1,5 +1,3 @@ -context("test-GP") - test_that("print.GP works", { expect_output(print(GP()), regexp = "GP") }) @@ -35,7 +33,7 @@ test_that("random.GP works correctly", { expect_length(random(g1[-1], 1), 0) expect_length(random(g1, 0), 0) expect_error(random(g1, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g1, c(1, 2, 3)), 3) expect_length(random(g1, cbind(1, 2, 3)), 3) @@ -46,7 +44,7 @@ test_that("random.GP works correctly", { expect_length(random(g2[-1], 1), 0) expect_length(random(g2, 0), 0) expect_error(random(g2, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g2, c(1, 2, 3)), 3) expect_length(random(g2, cbind(1, 2, 3)), 3) @@ -57,7 +55,7 @@ test_that("random.GP works correctly", { expect_length(random(g3[-1], 1), 0) expect_length(random(g3, 0), 0) expect_error(random(g3, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g3, c(1, 2, 3)), 3) expect_length(random(g3, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Geometric.R b/tests/testthat/test-Geometric.R index 987f4faa..e515ded1 100755 --- a/tests/testthat/test-Geometric.R +++ b/tests/testthat/test-Geometric.R @@ -1,5 +1,3 @@ -context("test-Geometric") - test_that("print.Geometric works", { expect_output(print(Geometric()), regexp = "Geometric") }) @@ -23,7 +21,7 @@ test_that("random.Geometric work correctly", { expect_length(random(cau[-1], 1), 0) expect_length(random(cau, 0), 0) expect_error(random(cau, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(cau, c(1, 2, 3)), 3) expect_length(random(cau, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Gumbel.R b/tests/testthat/test-Gumbel.R index 5814acb8..f7200753 100755 --- a/tests/testthat/test-Gumbel.R +++ b/tests/testthat/test-Gumbel.R @@ -1,5 +1,3 @@ -context("test-Gumbel") - test_that("print.Gumbel works", { expect_output(print(Gumbel()), regexp = "Gumbel") }) @@ -23,7 +21,7 @@ test_that("random.Gumbel works correctly", { expect_length(random(g2[-1], 1), 0) expect_length(random(g2, 0), 0) expect_error(random(g2, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g2, c(1, 2, 3)), 3) expect_length(random(g2, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-HurdleNegativeBinomial.R b/tests/testthat/test-HurdleNegativeBinomial.R index 738e1ab3..afe1fbf7 100755 --- a/tests/testthat/test-HurdleNegativeBinomial.R +++ b/tests/testthat/test-HurdleNegativeBinomial.R @@ -1,5 +1,3 @@ -context("test-HurdleNegativeBinomial") - test_that("print.HurdleNegativeBinomial works", { expect_output(print(HurdleNegativeBinomial(1, 1, 0.7)), regexp = "HurdleNegativeBinomial") }) @@ -12,7 +10,7 @@ test_that("random.HurdleNegativeBinomial work correctly", { expect_length(random(p[-1], 1), 0) expect_length(random(p, 0), 0) expect_error(random(p, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(p, c(1, 2, 3)), 3) expect_length(random(p, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-HurdlePoisson.R b/tests/testthat/test-HurdlePoisson.R index 96165b84..4d7029ad 100755 --- a/tests/testthat/test-HurdlePoisson.R +++ b/tests/testthat/test-HurdlePoisson.R @@ -1,5 +1,3 @@ -context("test-HurdlePoisson") - test_that("print.HurdlePoisson works", { expect_output(print(HurdlePoisson(1, 0.7)), regexp = "HurdlePoisson") }) @@ -12,7 +10,7 @@ test_that("random.HurdlePoisson work correctly", { expect_length(random(p[-1], 1), 0) expect_length(random(p, 0), 0) expect_error(random(p, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(p, c(1, 2, 3)), 3) expect_length(random(p, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-HyperGeometric.R b/tests/testthat/test-HyperGeometric.R index df83a18e..83838858 100755 --- a/tests/testthat/test-HyperGeometric.R +++ b/tests/testthat/test-HyperGeometric.R @@ -1,5 +1,3 @@ -context("test-HyperGeometric") - test_that("HyperGeometric works as intended when k > n + m", { expect_error(HyperGeometric(1, 1, 3)) }) @@ -28,7 +26,7 @@ test_that("random.HyperGeometric work correctly", { expect_length(random(h[-1], 1), 0) expect_length(random(h, 0), 0) expect_error(random(h, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(h, c(1, 2, 3)), 3) expect_length(random(h, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-LogNormal.R b/tests/testthat/test-LogNormal.R index a6e295fa..f8af0474 100755 --- a/tests/testthat/test-LogNormal.R +++ b/tests/testthat/test-LogNormal.R @@ -1,5 +1,3 @@ -context("test-LogNormal") - test_that("print.LogNormal works", { expect_output(print(LogNormal()), regexp = "LogNormal") }) @@ -23,7 +21,7 @@ test_that("random.LogNormal work correctly", { expect_length(random(cau[-1], 1), 0) expect_length(random(cau, 0), 0) expect_error(random(cau, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(cau, c(1, 2, 3)), 3) expect_length(random(cau, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Logistic.R b/tests/testthat/test-Logistic.R index aae9be89..43bd3cf2 100755 --- a/tests/testthat/test-Logistic.R +++ b/tests/testthat/test-Logistic.R @@ -1,5 +1,3 @@ -context("test-Logistic") - test_that("print.Logistic works", { expect_output(print(Logistic(1, 1)), regexp = "Logistic") }) @@ -23,7 +21,7 @@ test_that("random.Logistic work correctly", { expect_length(random(cau[-1], 1), 0) expect_length(random(cau, 0), 0) expect_error(random(cau, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(cau, c(1, 2, 3)), 3) expect_length(random(cau, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Multinomial.R b/tests/testthat/test-Multinomial.R index ff24f51d..48abda73 100755 --- a/tests/testthat/test-Multinomial.R +++ b/tests/testthat/test-Multinomial.R @@ -1,5 +1,3 @@ -context("test-Multinomial") - test_that("print.Multinomial works", { expect_output(print(Multinomial(1, 0.5)), regexp = "Multinomial") }) @@ -21,7 +19,7 @@ test_that("random.Multinomial work correctly", { # expect_length(random(m[-1], 1), 0) expect_length(random(m, 0), 0) expect_error(random(m, -2)) - + # consistent with base R, using the `length` as number of samples to draw # expect_length(random(m, c(1, 2, 3)), 3) # expect_length(random(m, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-NegativeBinomial.R b/tests/testthat/test-NegativeBinomial.R index c34352d4..f22ea8dd 100755 --- a/tests/testthat/test-NegativeBinomial.R +++ b/tests/testthat/test-NegativeBinomial.R @@ -1,5 +1,3 @@ -context("test-NegativeBinomial") - test_that("print.NegativeBinomial works", { expect_output(print(NegativeBinomial(1, 1)), regexp = "NegativeBinomial") }) @@ -30,7 +28,7 @@ test_that("random.NegativeBinomial work correctly", { expect_length(random(X[-1], 1), 0) expect_length(random(X, 0), 0) expect_error(random(X, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(X, c(1, 2, 3)), 3) expect_length(random(X, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Normal.R b/tests/testthat/test-Normal.R index 798c4b48..b3dd7b69 100755 --- a/tests/testthat/test-Normal.R +++ b/tests/testthat/test-Normal.R @@ -1,5 +1,3 @@ -context("test-Normal") - test_that("print.Normal works", { expect_output(print(Normal()), regexp = "Normal") }) @@ -23,7 +21,7 @@ test_that("random.Normal work correctly", { expect_length(random(n[-1], 1), 0) expect_length(random(n, 0), 0) expect_error(random(n, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(n, c(1, 2, 3)), 3) expect_length(random(n, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Poisson.R b/tests/testthat/test-Poisson.R index 39a11a21..8d416a6a 100755 --- a/tests/testthat/test-Poisson.R +++ b/tests/testthat/test-Poisson.R @@ -1,5 +1,3 @@ -context("test-Poisson") - test_that("print.Poisson works", { expect_output(print(Poisson(1)), regexp = "Poisson") }) @@ -34,7 +32,7 @@ test_that("random.Poisson work correctly", { expect_length(random(p[-1], 1), 0) expect_length(random(p, 0), 0) expect_error(random(p, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(p, c(1, 2, 3)), 3) expect_length(random(p, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-PoissonBinomial.R b/tests/testthat/test-PoissonBinomial.R index 68c2c8bd..48167142 100755 --- a/tests/testthat/test-PoissonBinomial.R +++ b/tests/testthat/test-PoissonBinomial.R @@ -1,5 +1,3 @@ -context("test-PoissonBinomial") - test_that("print.PoissonBinomial works", { expect_output(print(PoissonBinomial(0.5, 0.3, 0.8)), regexp = "PoissonBinomial") }) diff --git a/tests/testthat/test-RevWeibull.R b/tests/testthat/test-RevWeibull.R index ad91d963..f7e28ba9 100755 --- a/tests/testthat/test-RevWeibull.R +++ b/tests/testthat/test-RevWeibull.R @@ -1,5 +1,3 @@ -context("test-RevWeibull") - test_that("print.RevWeibull works", { expect_output(print(RevWeibull()), regexp = "RevWeibull") }) @@ -35,7 +33,7 @@ test_that("random.RevWeibull works correctly", { expect_length(random(g3[-1], 1), 0) expect_length(random(g3, 0), 0) expect_error(random(g3, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(g3, c(1, 2, 3)), 3) expect_length(random(g3, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-StudentsT.R b/tests/testthat/test-StudentsT.R index 6a9717e3..35cc007f 100755 --- a/tests/testthat/test-StudentsT.R +++ b/tests/testthat/test-StudentsT.R @@ -1,5 +1,3 @@ -context("test-StudentsT") - test_that("print.StudentsT works", { expect_output(print(StudentsT(1)), regexp = "StudentsT") }) @@ -23,7 +21,7 @@ test_that("random.StudentsT work correctly", { expect_length(random(s[-1], 1), 0) expect_length(random(s, 0), 0) expect_error(random(s, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(s, c(1, 2, 3)), 3) expect_length(random(s, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Tukey.R b/tests/testthat/test-Tukey.R index e6433172..38c667bf 100755 --- a/tests/testthat/test-Tukey.R +++ b/tests/testthat/test-Tukey.R @@ -1,5 +1,3 @@ -context("test-Tukey") - test_that("print.Tukey works", { expect_output(print(Tukey(1, 2, 2)), regexp = "Tukey") }) @@ -12,7 +10,7 @@ test_that("random.Tukey work correctly", { expect_length(random(d[-1], 1), 0) expect_length(random(d, 0), 0) expect_error(random(d, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(d, c(1, 2, 3)), 3) expect_length(random(d, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Uniform.R b/tests/testthat/test-Uniform.R index 63ff7a59..27cc7aa1 100755 --- a/tests/testthat/test-Uniform.R +++ b/tests/testthat/test-Uniform.R @@ -1,5 +1,3 @@ -context("test-Uniform") - test_that("print.Uniform works", { expect_output(print(Uniform(1, 1)), regexp = "Uniform") }) @@ -23,7 +21,7 @@ test_that("random.Uniform work correctly", { expect_length(random(u[-1], 1), 0) expect_length(random(u, 0), 0) expect_error(random(u, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(u, c(1, 2, 3)), 3) expect_length(random(u, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-Weibull.R b/tests/testthat/test-Weibull.R index 5e3d30e2..412bcc4b 100755 --- a/tests/testthat/test-Weibull.R +++ b/tests/testthat/test-Weibull.R @@ -1,5 +1,3 @@ -context("test-Weibull") - test_that("print.Weibull works", { expect_output(print(Weibull(1, 1)), regexp = "Weibull") }) @@ -23,7 +21,7 @@ test_that("random.Weibull work correctly", { expect_length(random(w[-1], 1), 0) expect_length(random(w, 0), 0) expect_error(random(w, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(w, c(1, 2, 3)), 3) expect_length(random(w, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-ZINegativeBinomial.R b/tests/testthat/test-ZINegativeBinomial.R index c5efb646..de91dbb1 100755 --- a/tests/testthat/test-ZINegativeBinomial.R +++ b/tests/testthat/test-ZINegativeBinomial.R @@ -1,5 +1,3 @@ -context("test-ZINegativeBinomial") - test_that("print.ZINegativeBinomial works", { expect_output(print(ZINegativeBinomial(1, 1, 0.3)), regexp = "ZINegativeBinomial") }) @@ -12,7 +10,7 @@ test_that("random.ZINegativeBinomial work correctly", { expect_length(random(p[-1], 1), 0) expect_length(random(p, 0), 0) expect_error(random(p, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(p, c(1, 2, 3)), 3) expect_length(random(p, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-ZIPoisson.R b/tests/testthat/test-ZIPoisson.R index 5cc1265e..8bd76a86 100755 --- a/tests/testthat/test-ZIPoisson.R +++ b/tests/testthat/test-ZIPoisson.R @@ -1,5 +1,3 @@ -context("test-ZIPoisson") - test_that("print.ZIPoisson works", { expect_output(print(ZIPoisson(1, 0.2)), regexp = "ZIPoisson") }) @@ -12,7 +10,7 @@ test_that("random.ZIPoisson work correctly", { expect_length(random(p[-1], 1), 0) expect_length(random(p, 0), 0) expect_error(random(p, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(p, c(1, 2, 3)), 3) expect_length(random(p, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-ZTNegativeBinomial.R b/tests/testthat/test-ZTNegativeBinomial.R index 9519c431..c5a37d03 100755 --- a/tests/testthat/test-ZTNegativeBinomial.R +++ b/tests/testthat/test-ZTNegativeBinomial.R @@ -1,5 +1,3 @@ -context("test-ZTNegativeBinomial") - test_that("print.ZTNegativeBinomial works", { expect_output(print(ZTNegativeBinomial(1, 1)), regexp = "ZTNegativeBinomial") }) @@ -12,7 +10,7 @@ test_that("random.ZTNegativeBinomial work correctly", { expect_length(random(p[-1], 1), 0) expect_length(random(p, 0), 0) expect_error(random(p, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(p, c(1, 2, 3)), 3) expect_length(random(p, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-ZTPoisson.R b/tests/testthat/test-ZTPoisson.R index 3ac07b12..0f0aa6d3 100755 --- a/tests/testthat/test-ZTPoisson.R +++ b/tests/testthat/test-ZTPoisson.R @@ -1,5 +1,3 @@ -context("test-ZTPoisson") - test_that("print.ZTPoisson works", { expect_output(print(ZTPoisson(1)), regexp = "ZTPoisson") }) @@ -12,7 +10,7 @@ test_that("random.ZTPoisson work correctly", { expect_length(random(p[-1], 1), 0) expect_length(random(p, 0), 0) expect_error(random(p, -2)) - + # consistent with base R, using the `length` as number of samples to draw expect_length(random(p, c(1, 2, 3)), 3) expect_length(random(p, cbind(1, 2, 3)), 3) diff --git a/tests/testthat/test-methods.R b/tests/testthat/test-methods.R index e87acae2..007a3a5e 100755 --- a/tests/testthat/test-methods.R +++ b/tests/testthat/test-methods.R @@ -1,5 +1,3 @@ -context("test-methods") - test_that("pmf() works", { N <- Normal() B <- Bernoulli() diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R index fe936d22..2eb2bf98 100755 --- a/tests/testthat/test-plot.R +++ b/tests/testthat/test-plot.R @@ -1,5 +1,3 @@ -context("test-PlotDistribution") - test_that("Error thrown for incorrect input to plot.distribution", { expect_error(plot.distribution(1)) }) diff --git a/tests/testthat/test-prodist.R b/tests/testthat/test-prodist.R index e89067ff..956fabd2 100755 --- a/tests/testthat/test-prodist.R +++ b/tests/testthat/test-prodist.R @@ -1,5 +1,3 @@ -context("test-prodist") - ## simulate data set.seed(0) d <- data.frame(x = runif(10, -1, 1)) diff --git a/tests/testthat/test-simulate.R b/tests/testthat/test-simulate.R index 71c38c1b..6b851f64 100755 --- a/tests/testthat/test-simulate.R +++ b/tests/testthat/test-simulate.R @@ -1,5 +1,3 @@ -context("test-simulate") - test_that("simulate() methods work and return equivalent results", { ## Poisson GLM for FIFA 2018 goals data data("FIFA2018", package = "distributions3") @@ -23,7 +21,7 @@ test_that("simulate() methods work and return equivalent results", { g_manual <- as.data.frame(replicate(3, rpois(nobs(m), fitted(m)))) ## same results - expect_equivalent(g_glm, g_default) + expect_equal(g_glm, g_default, ignore_attr = TRUE) expect_identical(g_default, g_distribution) - expect_equivalent(g_glm, g_manual) + expect_equal(g_glm, g_manual, ignore_attr = TRUE) }) diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index ce73e641..4176c944 100755 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -1,5 +1,3 @@ -context("test-utils") - test_that("is_distribution() works", { expect_true(is_distribution(Normal())) expect_false(is_distribution(123)) @@ -318,16 +316,16 @@ test_that("apply_dpqr() applied to 'pdf', 'log_pdf' and 'cdf' works", { expect_null(dim(pdf(N[1:2], c(0.2, 0.5)))) expect_length(pdf(N[1:2], c(0.2, 0.5)), 2) expect_equal( - pdf(N[1:2], cbind(c(0.2, 0.5))), + pdf(N[1:2], cbind(c(0.2, 0.5))), matrix( - rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), + rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), ncol = 2, dimnames = list(NULL, c("d_0.2", "d_0.5")) ) ) expect_equal( - pdf(N[1:2], rbind(c(0.2, 0.5))), + pdf(N[1:2], rbind(c(0.2, 0.5))), matrix( - rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), + rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), ncol = 2, dimnames = list(NULL, c("d_0.2", "d_0.5")) ) ) @@ -340,16 +338,16 @@ test_that("apply_dpqr() applied to 'pdf', 'log_pdf' and 'cdf' works", { expect_true(is.numeric(pdf(N[1:2], c(0.2, 0.5), drop = FALSE))) expect_equal(dim(pdf(N[1:2], c(0.2, 0.5), drop = FALSE)), c(2L, 1L)) expect_equal( - pdf(N[1:2], cbind(c(0.2, 0.5)), drop = FALSE), + pdf(N[1:2], cbind(c(0.2, 0.5)), drop = FALSE), matrix( - rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), + rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), ncol = 2, dimnames = list(NULL, c("d_0.2", "d_0.5")) ) ) expect_equal( - pdf(N[1:2], rbind(c(0.2, 0.5)), drop = FALSE), + pdf(N[1:2], rbind(c(0.2, 0.5)), drop = FALSE), matrix( - rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), + rbind(pdf(N[1], c(0.2, 0.5)), pdf(N[2], c(0.2, 0.5))), ncol = 2, dimnames = list(NULL, c("d_0.2", "d_0.5")) ) )