Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ellipsis dependency + address deprecation warnings #105

Merged
merged 7 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:

name: R-CMD-check

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand All @@ -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 }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:

name: pkgdown

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:

name: test-coverage

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
Expand All @@ -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: |
Expand Down
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions R/Bernoulli.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down Expand Up @@ -281,20 +281,20 @@ 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)
}

#' @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))
}
8 changes: 4 additions & 4 deletions R/Beta.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -208,20 +208,20 @@ 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)
}

#' @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))
}
8 changes: 4 additions & 4 deletions R/Binomial.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -300,20 +300,20 @@ 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)
}

#' @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))
}
6 changes: 3 additions & 3 deletions R/Categorical.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand All @@ -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))
}
8 changes: 4 additions & 4 deletions R/Cauchy.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -240,20 +240,20 @@ 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)
}

#' @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))
}
8 changes: 4 additions & 4 deletions R/ChiSquare.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -259,20 +259,20 @@ 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)
}

#' @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))
}
6 changes: 3 additions & 3 deletions R/Erlang.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,20 @@ 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)
}

#' @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))
}
8 changes: 4 additions & 4 deletions R/Exponential.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -265,20 +265,20 @@ 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)
}

#' @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))
}
8 changes: 4 additions & 4 deletions R/FisherF.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -236,20 +236,20 @@ 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)
}

#' @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))
}
Loading
Loading