Skip to content
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
108 changes: 13 additions & 95 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,100 +1,18 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
name: R-CMD-check
on:
push:
branches: main
branches: [main, master]
pull_request:
branches: main
schedule:
- cron: '0 8 * * 0' # Every Sunday at midnight PST = Monday at 08:00 UTC

name: R-CMD-check.yaml

permissions: read-all

branches: [main, master, dev]
permissions:
contents: read
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# use 4.0 or 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: 'oldrel-3'}

- {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'}

env:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
if: github.event_name != 'schedule'
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

- name: 🧪 Run R-CMD-check and save summary
if: github.event_name == 'schedule' && github.repository_owner == 'poissonconsulting'

env:
OS: ${{ matrix.config.os }}
R: ${{ matrix.config.r }}
run: |
check <- rcmdcheck::rcmdcheck(
args = "--no-manual",
error_on = "never"
)
result <- toupper(check$status)
log_text <- paste(
utils::capture.output(print(check)),
collapse = "\n"
)
filename <- paste0(Sys.getenv("OS"), "-R-", Sys.getenv("R"), ".txt")
cat(result, "\n---\n", log_text, "\n", file = filename)
shell: Rscript {0}

- name: 💾 Upload status artifact
if: github.event_name == 'schedule' && github.repository_owner == 'poissonconsulting'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.os }}-R-${{ matrix.config.r }}
path: ${{ matrix.config.os }}-R-${{ matrix.config.r }}.txt
retention-days: 6

- name: 💾 Upload snapshot artifacts
if: github.event_name == 'schedule' && github.repository_owner == 'poissonconsulting'
uses: actions/upload-artifact@v4
with:
name: snapshots-${{ matrix.config.os }}-R-${{ matrix.config.r }}
path: tests/testthat/_snaps
retention-days: 6
uses: poissonconsulting/.github/.github/workflows/R-CMD-check.yaml@v1
with:
tier: cran
jags: false
cmdstan: false
tex: true
private: false
secrets: inherit
14 changes: 14 additions & 0 deletions .github/workflows/check-no-suggests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: check-no-suggests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master, dev]
permissions:
contents: read
jobs:
check-no-suggests:
uses: poissonconsulting/.github/.github/workflows/check-no-suggests.yaml@v1
with:
private: false
secrets: inherit
49 changes: 9 additions & 40 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,18 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
name: pkgdown
on:
push:
branches: [main, master]
pull_request:
branches: [main, master, dev]
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

permissions:
contents: write
jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
uses: poissonconsulting/.github/.github/workflows/pkgdown.yaml@v1
with:
cmdstan: false
private: false
secrets: inherit
4 changes: 4 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.
#
# Distributed to CRAN-tier packages by poissonconsulting/.github tools/sync-ci.sh.
# It is dispatch-triggered (run via rhub::rhub_check()), not a push/PR check, so it
# is vendored as-is rather than called as a reusable workflow.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"
Expand Down
68 changes: 11 additions & 57 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
name: test-coverage
on:
push:
branches: main
branches: [main, master]
pull_request:

name: test-coverage.yaml

permissions: read-all

branches: [main, master, dev]
permissions:
contents: read
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v7
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
files: ./cobertura.xml
plugins: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
uses: poissonconsulting/.github/.github/workflows/test-coverage.yaml@v1
with:
cmdstan: false
tex: true
private: false
secrets: inherit
10 changes: 9 additions & 1 deletion R/glance.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ generics::glance
npars <- npars(x)
log_lik <- logLik(x)
aic <- 2 * npars - 2 * log_lik
aicc <- aic + 2 * npars * (npars + 1) / (nobs - npars - 1)
if (isTRUE(nobs <= npars)) {
aicc <- Inf
} else {
aicc <- aic + 2 * npars * (npars + 1) / (nobs - npars - 1)
}

tibble(
dist = dist,
Expand All @@ -39,6 +43,10 @@ generics::glance
#'
#' Gets a tibble with a single row for each distribution.
#'
#' The `aicc` is `Inf` if the number of observations is less than
#' the number of parameters plus two as the small sample size
#' correction is undefined.
#'
#' @inheritParams params
#' @return A tidy tibble of the distributions.
#' @family generics
Expand Down
14 changes: 10 additions & 4 deletions R/hcp-average.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ hcp_average <- function(
)
}

## Compute on the unique values so the various ci/est functions (some of
## which collapse duplicates via group_by()) agree on the row structure,
## then re-expand to the input `value` vector preserving order and duplicates.
uvalue <- unique(value)

est_same <- FALSE
ci_fun <- if (!ci) {
hcp_noci
Expand All @@ -75,7 +80,7 @@ hcp_average <- function(

hcp <- ci_fun(
x,
value = value,
value = uvalue,
ci = ci,
level = level,
nboot = nboot,
Expand All @@ -98,7 +103,7 @@ hcp_average <- function(
)

if (est_same) {
return(hcp)
return(hcp[match(value, hcp$value), ])
}

est_fun <- if (est_method == "multi") {
Expand All @@ -108,7 +113,7 @@ hcp_average <- function(
}
est <- est_fun(
x,
value,
uvalue,
ci = FALSE,
level = level,
nboot = nboot,
Expand All @@ -128,5 +133,6 @@ hcp_average <- function(
ci_method = "MACL",
hc = hc
)
replace_estimates(hcp, est)
hcp <- replace_estimates(hcp, est)
hcp[match(value, hcp$value), ]
}
5 changes: 5 additions & 0 deletions man/glance.fitdists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions tests/testthat/_snaps/hp/hc_fix.csv

This file was deleted.

7 changes: 0 additions & 7 deletions tests/testthat/_snaps/hp/hc_unfix.csv

This file was deleted.

8 changes: 0 additions & 8 deletions tests/testthat/_snaps/hp/hp_30.csv

This file was deleted.

Loading
Loading