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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
^docs$
^pkgdown$
^tools$
^scratch\.R$
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md linguist-generated
man/** linguist-generated
83 changes: 83 additions & 0 deletions .github/workflows/dependency-change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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
# Adapted from Epiverse packages: https://github.com/epiverse-trace
on:
pull_request:
paths:
- 'DESCRIPTION'

name: Analyze dependency changes

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write

jobs:
dependency-changes:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: any::pak, glue, gh

- name: Analyze dependency changes
shell: Rscript {0}
run: |
deps_base <- pak::pkg_deps("${{ github.repository }}@${{ github.base_ref }}", dependencies = TRUE) |>
subset(!directpkg) |>
subset(is.na(priority))
# We install from PR number rather than branch to deal with the case
# of PR coming from forks
deps_head <- pak::pkg_deps("${{ github.repository }}#${{ github.event.number }}", dependencies = TRUE) |>
subset(!directpkg) |>
subset(is.na(priority))

deps_added <- deps_head |>
subset(!ref %in% deps_base$ref)

deps_removed <- deps_base |>
subset(!ref %in% deps_head$ref)

if (nrow(deps_added) + nrow(deps_removed) > 0) {

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:",
"- Adds {nrow(deps_added)} new dependencies (direct and indirect)",
"- Adds {length(unique(deps_added$sysreqs))} new system dependencies",
"- Removes {nrow(deps_removed)} existing dependencies (direct and indirect)",
"- Removes {length(unique(deps_removed$sysreqs))} existing system dependencies",
"",
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.")

gh::gh(
"POST /repos/{repo}/issues/{issue_number}/comments",
repo = "${{ github.repository }}",
issue_number = "${{ github.event.number }}",
body = msg
)

}
97 changes: 97 additions & 0 deletions .github/workflows/render-readme.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Adapted from Epiverse packages: https://github.com/epiverse-trace
# Reproduce locally by running:
# ```r
# pak::pak(c("any::rmarkdown", "any::usethis", "."))
# writeLines(
# knitr::knit_expand(
# "README.Rmd",
# packagename = read.dcf("DESCRIPTION", "Package"),
# gh_repo = usethis:::github_remote_list()$repo_spec
# ),
# "README_expanded.Rmd"
# )
# rmarkdown::render(
# "README_expanded.Rmd",
# output_file = "README.md",
# output_dir = "."
# )
# unlink("README_expanded.Rmd")
# ```
name: render-readme

# Controls when the action will run. Triggers include:
#
# - button trigger from github action page
# - on changes to readme.Rmd

on:
workflow_dispatch:
push:
branches:
# This may seem like a no-op but it prevents triggering on tags
# We use '**' rather '*' to accomodate names like 'dev/branch-1'
- '**'
paths:
- 'README.Rmd'
- '.github/workflows/render_readme.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
render-readme:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repos
uses: actions/checkout@v4

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

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

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rmarkdown, local::.

- name: Compile the readme
run: |
writeLines(
knitr::knit_expand(
"README.Rmd",
packagename = read.dcf("DESCRIPTION", "Package"),
gh_repo = Sys.getenv("GITHUB_REPOSITORY")
),
"README_expanded.Rmd"
)
rmarkdown::render(
"README_expanded.Rmd",
output_file = "README.md",
output_dir = "."
)
shell: Rscript {0}

- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
# Also add README figures if they exist
if [ -d man/figures ]
then
git add man/figures/
fi
git diff-index --quiet HEAD || git commit -m "Automatic readme update"
git pull --rebase origin ${{ github.ref.name }}
git push origin || echo "No changes to push"
38 changes: 38 additions & 0 deletions .github/workflows/update-copyright-year.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Adapted from Epiverse packages: https://github.com/epiverse-trace
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)(?<from>\d{4})?-?(\d{4})?
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ po/*~
rsconnect/
inst/doc
docs
scratch.R
6 changes: 1 addition & 5 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
linters: all_linters(
indentation_linter = NULL, # unstable as of lintr 3.1.0
extraction_operator_linter = NULL, # lints auto-generated vignette setup chunks
implicit_integer_linter = NULL, # turn off due to multiple integerish values used
duplicate_argument_linter = NULL, # due to cli_bullets
object_name_linter = NULL, # due to S3 methods
Expand All @@ -20,8 +19,5 @@ exclusions: list(
),
"vignettes" = list(
undesirable_function_linter = Inf
),
# do no attempt to lint auto-generated files
"R/RcppExports.R",
"R/cpp11.R"
)
)
21 changes: 15 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
Package: vimc.rpkg.template
Title: Your Package Title in Title Case
Version: 0.0.0.9000
Package: vimcheck
Title: Diagnostics for Vaccine Impact Modelling Consortium Burden and
Impact Estimates
Version: 0.0.1
Authors@R: c(
person("Pratik", "Gupte", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5294-7819")),
person("Katy", "Gaythorpe", role = "aut",
comment = c(ORCID = "0000-0003-3734-9081")),
person("Xiang", "Li", role = "aut",
comment = c(ORCID = "0000-0002-5945-159X")),
person("Zoë", "Gibney", role = "aut",
comment = c(ORCID = "0009-0002-8114-9984")),
person("Imperial College of Science, Technology and Medicine", role = c("cph", "fnd"))
)
Description: Your package description. It must end with a period (".") and
include relevant bibliographical references if applicable, using the
following format: Author et al. (2023) <doi:10.5281/zenodo.6619350>.
Description: Run diagnostics on burden estimates submitted by modellers in
the Vaccine Impact Modelling Consortium (VIMC) and impact estimates
calculated by the VIMC Science & Policy team.
License: MIT + file LICENSE
URL: https://github.com/vimc/vimcheck, https://vimc.github.io/vimcheck/
BugReports: https://github.com/vimc/vimcheck/issues
Suggests:
knitr,
rmarkdown,
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Generated by roxygen2: do not edit by hand

export(get_manual_mean)
10 changes: 6 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# vimc.rpkg.template 0.0.1
# vimcheck 0.0.1

* This project now includes a
[`NEWS.md`](https://r-pkgs.org/other-markdown.html#sec-news) file to inform
users about changes and new features.
- Added GHA workflows to notify of changed dependencies, auto-render `README.md` from `README.Rmd`, and update the copyright year annually.

- Added reference to VIMC paper (Echeverria-Londono et al. 2021).

- Added `.gitattributes` marking autogenerated Readme and docs files as such.
10 changes: 0 additions & 10 deletions R/functions.R

This file was deleted.

File renamed without changes.
40 changes: 11 additions & 29 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
output: github_document
# add bibliography here
bibliography: vignettes/resources/references.json
link-citations: true
---

Expand All @@ -15,40 +15,25 @@ knitr::opts_chunk$set(
)
```

# vimc.rpkg.template: TAGLINE
# vimcheck: Diagnostics for Vaccine Impact Modelling Consortium burden and impact estimates

<!-- badges: start -->
[![Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept.](https://www.repostatus.org/badges/latest/concept.svg)](https://www.repostatus.org/#concept)
[![R build status](https://github.com/vimc/vimc.rpkg.template/workflows/R-CMD-check/badge.svg)](https://github.com/vimc/vimc.rpkg.template/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/vimc/vimc.rpkg.template/branch/main/graph/badge.svg)](https://app.codecov.io/gh/vimc/vimc.rpkg.template?branch=main)
[![CRAN status](https://www.r-pkg.org/badges/version/vimc.rpkg.template)](https://CRAN.R-project.org/package=vimc.rpkg.template)
[![R build status](https://github.com/vimc/vimcheck/workflows/R-CMD-check/badge.svg)](https://github.com/vimc/vimcheck/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/vimc/vimcheck/branch/main/graph/badge.svg)](https://app.codecov.io/gh/vimc/vimcheck?branch=main)
[![CRAN status](https://www.r-pkg.org/badges/version/vimcheck)](https://CRAN.R-project.org/package=vimcheck)
<!-- badges: end -->

_vimc.rpkg.template_ is a template package and repository on which future VIMC R packages are based.

To use this template, select _vimc.rpkg.template_ from the drop-down menu under **Repository template** when creating a new repository in the VIMC GitHub organisation.
Replace all instances of `"vimc.rpkg.template"` with your package name. Make sure to also:

1. Edit the `DESCRIPTION` as appropriate with the correct package information, including authors;

2. Edit the files in `R/`, `tests/`, and `vignettes/` to suit your package;

3. Add spell check by running `usethis::use_spell_check(lang = "en-GB")`;

4. Remove these instructions from `README.Rmd`, and re-render the `.md` file using `devtools::render_readme()`.
_vimcheck_ is an R package for running diagnostic checks on burden estimates submitted to the Vaccine Impact Modelling Consortium (VIMC), and on vaccine impact estimates calculated by VIMC.

## Installation

**NOTE:** Remove or comment out installation sources as appropriate.

**Remember** to add the package to the [VIMC R-universe](https://github.com/vimc/vimc.r-universe.dev).

You can install the development version of _vimc.rpkg.template_ from the VIMC R-universe with:
You can install the development version of _vimcheck_ from the VIMC R-universe with:

```r
installation from R-universe
install.packages(
"vimc.rpkg.template",
"vimcheck",
repos = c(
"https://vimc.r-universe.dev", "https://cloud.r-project.org"
)
Expand All @@ -59,18 +44,15 @@ or from GitHub [GitHub](https://github.com/) with:

``` r
install.packages("pak")
pak::pak("vimc/vimc.rpkg.template")
pak::pak("vimc/vimcheck")
```

## Quick start

Add a simple example of using the package's main feature(s) here, with a minimum amount of code.
If preparatory or plotting steps are needed, prefer to hide them to keep focus on the package functionality.
WIP.

## Related projects

Add information and links to related projects, such as research papers or packages, here.
VIMC impact assessment workflows are described in @echeverria-londono2021.

## References

Space for references: REMOVE this text.
Loading