diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 3758026a..00000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,51 +0,0 @@ -# Contributing to epichains - -This outlines how to propose a change to epichains. - -## Making changes - -If you want to make a change, it's a good idea to first file an issue and make -sure someone from the team agrees that it’s needed. -If you’ve found a bug, please file an issue that illustrates the bug with -a minimal [reprex](https://www.tidyverse.org/help/#reprex) (this will also -help you write a unit test, if needed). See [bug report template](../.github/ISSUE_TEMPLATE/bug_report.md). If you have a -feature request see [feature request](../.github/ISSUE_TEMPLATE/feature_request.md). - -### Pull request process - -See [pull request template](../.github/PULL_REQUEST_TEMPLATE/pull_request_template.md) - -* Fork the package and clone onto your computer. If you haven't done -this before, we recommend using `usethis::create_from_github("epiverse-trace/epichains", fork = TRUE)`. - -* Install all development dependencies with `devtools::install_dev_deps()`, -and then make sure the package passes R CMD check by running `devtools::check()`. - If R CMD check doesn't pass cleanly, it's a good idea to ask for - help before continuing. -* Create a Git branch for your pull request (PR). We recommend using `usethis::pr_init("brief-description-of-change")`. - -* Make your changes, commit to git, and then create a PR by running `usethis::pr_push()`, and following the prompts in your browser. - The title of your PR should briefly describe the change. - The body of your PR should contain `Fixes #issue-number`. - -* For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just -below the first header). Follow the style described in . - -### Code style - -* New code should follow the tidyverse [style guide](https://style.tidyverse.org). - You can use the [styler](https://CRAN.R-project.org/package=styler) - package to apply these styles, but please don't restyle code that has - nothing to do with your PR. - -* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation. - -* We use [testthat](https://cran.r-project.org/package=testthat) for -unit tests. - Contributions with test cases included are easier to accept. - -## Code of Conduct - -Please note that `epichains` is released with a -[Contributor Code of Conduct](https://github.com/epiverse-trace/.github/blob/main/CODE_OF_CONDUCT.md). By contributing to this -project you agree to abide by its terms. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 6d32efc5..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -Please place an "x" in all the boxes that apply ---------------------------------------------- - -- [ ] I have the most recent version of epichains and R -- [ ] I have found a bug -- [ ] I have a [reproducible example](http://reprex.tidyverse.org/articles/reprex-dos-and-donts.html) -- [ ] I want to request a new feature - --------- - -Please include a brief description of the problem with a code example: - -```r -# insert reprex here -``` - ---------- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 3fe3d3f8..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. E.g., I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index 706632aa..00000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,25 +0,0 @@ -* **Please check if the PR fulfils these requirements** - -- [ ] I have read the CONTRIBUTING guidelines -- [ ] The commit message follows our guidelines -- [ ] Tests for the changes have been added (for bug fixes / features) -- [ ] Docs have been added / updated (for bug fixes / features) - - -* **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) - - - -* **What is the current behaviour?** (You can also link to an open issue here) - - - -* **What is the new behaviour (if this is a feature change)?** - - - -* **Does this PR introduce a breaking change?** (What changes might users need to make in their application due to this PR?) - - - -* **Other information**: diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 4d9fd893..1e9d66d3 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,5 +1,12 @@ + # 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 +# +# Reproduce locally by running: +# ```r +# pak::pak(c("any::rcmdcheck", "."), dependencies = "Config/Needs/check") +# rcmdcheck::rcmdcheck() +# ``` on: push: branches: [main, master] @@ -16,8 +23,8 @@ on: - 'LICENSE' - '.Rbuildignore' - '.github/workflows/R-CMD-check.yaml' + merge_group: pull_request: - branches: [main, master] paths: - 'data/**' - 'R/**' @@ -48,7 +55,7 @@ jobs: fail-fast: false matrix: config: - - {os: macos-latest, r: 'release'} + - {os: macOS-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} @@ -57,8 +64,6 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes - # Exists since R 4.3.0 but `false` by default - _R_CHECK_LENGTH_COLON_: true steps: - uses: actions/checkout@v4 @@ -80,6 +85,7 @@ jobs: id: rcmdcheck with: upload-snapshots: true + error-on: '"note"' # fail-fast but only if rcmdcheck step fails - name: Manual fail-fast diff --git a/.github/workflows/dependency-change.yaml b/.github/workflows/dependency-change.yaml index 1250c8a5..ef26e664 100644 --- a/.github/workflows/dependency-change.yaml +++ b/.github/workflows/dependency-change.yaml @@ -52,6 +52,12 @@ jobs: message("Dependencies have changed! Analyzing...") + if (nrow(deps_added) > 0) { + nudge <- "Reach out on slack (`#code-review` or `#help` channels) to double check if there are base R alternatives to the new dependencies.\n" + } else { + nudge <- "" + } + msg <- glue::glue( .sep = "\n", "This pull request:", @@ -60,7 +66,8 @@ jobs: "- Removes {nrow(deps_removed)} existing dependencies (direct and indirect)", "- Removes {length(unique(deps_removed$sysreqs))} existing system dependencies", "", - "(Note that results may be inacurrate if you branched from an outdated version of the target branch.)" + nudge, + "(Note that results may be inaccurate if you branched from an outdated version of the target branch.)" ) message("Posting results as a pull request comment.") diff --git a/.github/workflows/lint-changed-files.yaml b/.github/workflows/lint-changed-files.yaml index 68bc6645..f9aa5c54 100644 --- a/.github/workflows/lint-changed-files.yaml +++ b/.github/workflows/lint-changed-files.yaml @@ -4,6 +4,11 @@ on: workflow_dispatch: pull_request: branches: [main, master] + paths: + - '**.R' + - '**.Rmd' + - '**/.lintr' + - '**/.lintr.R' name: lint-changed-files diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 3a9b2773..84715ae0 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -21,6 +21,7 @@ on: - 'DESCRIPTION' - '.Rbuildignore' - '.github/**' + merge_group: pull_request: paths: - 'README.Rmd' @@ -44,13 +45,14 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: write + jobs: pkgdown: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - permissions: - contents: write steps: - uses: actions/checkout@v4 @@ -69,8 +71,13 @@ jobs: run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} + - name: Check website links + uses: untitaker/hyperlink@0.1.32 + with: + args: docs/ + - name: Deploy to GitHub pages 🚀 - if: github.event_name != 'pull_request' + if: github.event_name != 'merge_group' && github.event_name != 'pull_request' uses: JamesIves/github-pages-deploy-action@v4.6.0 with: # We clean on releases because we want to remove old vignettes, diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 1d705b2a..8230b253 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,5 +1,11 @@ # 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 +# +# Reproduce locally by running: +# ```r +# pak::pak("any::covr", dependencies = "Config/Needs/coverage") +# covr::codecov(quiet = FALSE) +# ``` on: push: branches: [main, master] @@ -10,8 +16,8 @@ on: - 'inst/**' - 'DESCRIPTION' - '.github/workflows/test-coverage.yaml' + merge_group: pull_request: - branches: [main, master] paths: - 'R/**' - 'src/**' diff --git a/.github/workflows/update-citation-cff.yaml b/.github/workflows/update-citation-cff.yaml index 8e51fc69..ebb4b4d1 100644 --- a/.github/workflows/update-citation-cff.yaml +++ b/.github/workflows/update-citation-cff.yaml @@ -1,13 +1,13 @@ + # Workflow derived from https://github.com/r-lib/actions/tree/master/examples # The action runs when: -# - A new release is published # - The DESCRIPTION or inst/CITATION are modified # - Can be run manually # For customizing the triggers, visit https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows on: - release: - types: [published] push: + branches: + - main paths: - DESCRIPTION - inst/CITATION @@ -15,6 +15,9 @@ on: workflow_dispatch: name: Update CITATION.cff +permissions: + contents: write + pull-requests: write jobs: update-citation-cff: @@ -29,21 +32,29 @@ jobs: extra-packages: | any::cffr any::V8 + - name: Update CITATION.cff run: | + library(cffr) + # Customize with your own code # See https://docs.ropensci.org/cffr/articles/cffr.html + # Write your own keys mykeys <- list() + # Create your CITATION.cff file cff_write(keys = mykeys) + shell: Rscript {0} + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + commit-message: Update `CITATION.cff` + title: Update `CITATION.cff` + body: | + This pull request updates the citation file, ensuring all authors are credited and there are no discrepancies. - - name: Commit results - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add CITATION.cff - git commit -m 'Update CITATION.cff' || echo "No changes to commit" - git push origin || echo "No changes to commit" + Please verify the changes before merging. + branch: update-citation-cff diff --git a/.github/workflows/update-copyright-year.yml b/.github/workflows/update-copyright-year.yml new file mode 100644 index 00000000..b4633b3c --- /dev/null +++ b/.github/workflows/update-copyright-year.yml @@ -0,0 +1,37 @@ +name: Update copyright year(s) in license file + +on: + workflow_dispatch: + schedule: + - cron: '0 3 1 1 *' + +permissions: + contents: write + pull-requests: write + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: FantasticFiasco/action-update-license-year@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + path: | + LICENSE.md + prBody: > + This PR updates the copyright license for this new year! If you're reading this while you're celebrating, enjoy! Don't worry about this one :blush: + + ![Happy new year!](https://media.giphy.com/media/HyDfNCZlTn5iU/giphy.gif?cid=ecf05e4777yl7dbo1xfha6bx1z5lrl13uq7biv6rs9dqsyoh&ep=v1_gifs_search&rid=giphy.gif&ct=g) + - uses: FantasticFiasco/action-update-license-year@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + path: | + LICENSE + prBody: > + This PR updates the copyright license for this new year! If you're reading this while you're celebrating, enjoy! Don't worry about this one :blush: + + ![Happy new year!](https://media.giphy.com/media/HyDfNCZlTn5iU/giphy.gif?cid=ecf05e4777yl7dbo1xfha6bx1z5lrl13uq7biv6rs9dqsyoh&ep=v1_gifs_search&rid=giphy.gif&ct=g) + transform: (?<=YEAR:\s)(?\d{4})?-?(\d{4})? diff --git a/README.Rmd b/README.Rmd index daafcf46..bed77b5d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -240,8 +240,7 @@ To report a bug please open an [issue](https://github.com/epiverse-trace/epichai ## Contribute -We welcome contributions to enhance the package's functionalities. If you -wish to do so, please follow the [package contributing guide](https://github.com/epiverse-trace/epichains/blob/main/.github/CONTRIBUTING.md). +Contributions to {epichains} are welcomed. Please follow the [package contributing guide](https://github.com/epiverse-trace/.github/blob/main/CONTRIBUTING.md). ## Code of conduct diff --git a/README.md b/README.md index ac7ce70f..d6b618e4 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,9 @@ head(sim_chains) #> 24 3 1 3 2 3 #> 25 4 1 2 2 3 #> 26 6 1 2 2 3 +``` + +``` r # Summarise the simulation summary(sim_chains) @@ -130,6 +133,9 @@ summary(sim_chains) #> #> Max: >=25 #> Min: 1 +``` + +``` r # Aggregate the simulation into cases per generation chains_agrgegated <- aggregate(sim_chains, by = "generation") @@ -151,6 +157,9 @@ set.seed(32) chain_lengths <- sample(1:40, 20, replace = TRUE) chain_lengths #> [1] 6 11 20 9 40 33 39 27 6 12 39 35 9 25 6 15 12 6 37 35 +``` + +``` r # estimate loglikelihood of the observed chain sizes likelihood_eg <- likelihood( @@ -271,9 +280,9 @@ To report a bug please open an ## Contribute -We welcome contributions to enhance the package’s functionalities. If -you wish to do so, please follow the [package contributing -guide](https://github.com/epiverse-trace/epichains/blob/main/.github/CONTRIBUTING.md). +Contributions to {epichains} are welcomed. Please follow the [package +contributing +guide](https://github.com/epiverse-trace/.github/blob/main/CONTRIBUTING.md). ## Code of conduct diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/pkgdown/favicon/apple-touch-icon-120x120.png new file mode 100644 index 00000000..59dd470c Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-120x120.png differ diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/pkgdown/favicon/apple-touch-icon-152x152.png new file mode 100644 index 00000000..4f181612 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-152x152.png differ diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/pkgdown/favicon/apple-touch-icon-180x180.png new file mode 100644 index 00000000..0e8edc07 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-180x180.png differ diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/pkgdown/favicon/apple-touch-icon-60x60.png new file mode 100644 index 00000000..92e0e0a3 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-60x60.png differ diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/pkgdown/favicon/apple-touch-icon-76x76.png new file mode 100644 index 00000000..22138d77 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-76x76.png differ diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png new file mode 100644 index 00000000..0e8edc07 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon.png differ diff --git a/pkgdown/favicon/favicon-16x16.png b/pkgdown/favicon/favicon-16x16.png new file mode 100644 index 00000000..26d653a2 Binary files /dev/null and b/pkgdown/favicon/favicon-16x16.png differ diff --git a/pkgdown/favicon/favicon-32x32.png b/pkgdown/favicon/favicon-32x32.png new file mode 100644 index 00000000..281e64e4 Binary files /dev/null and b/pkgdown/favicon/favicon-32x32.png differ diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico new file mode 100644 index 00000000..7e0f6359 Binary files /dev/null and b/pkgdown/favicon/favicon.ico differ