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

{simulist} full package review #33

Closed
wants to merge 184 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
96d0dc9
Automatic readme update
actions-user Aug 30, 2023
88d62fb
updated DESCRIPTION with title, description, authors & dependencies
joshwlambert Oct 12, 2023
fcf014b
updated .Rbuildignore and .gitignore
joshwlambert Oct 12, 2023
ba60494
added simulist.Rproj
joshwlambert Oct 12, 2023
f419e11
added sim_linelist function
joshwlambert Oct 12, 2023
648640b
added internal functions to add info to linelist
joshwlambert Oct 12, 2023
ed3a580
updated NAMESPACE
joshwlambert Oct 12, 2023
d980d36
updated WORDLIST
joshwlambert Oct 12, 2023
4c314ca
added test for sim_linelist
joshwlambert Oct 12, 2023
6875759
temporary warnPartialMatchArg = FALSE
joshwlambert Oct 12, 2023
dc1c1b7
Update CITATION.cff
actions-user Oct 12, 2023
04a2658
added create_contacts WIP function
joshwlambert Oct 12, 2023
1dc4cc3
updated .add_hospitalisation and .add_deaths to also handle pop-wide …
joshwlambert Oct 12, 2023
0b9eb61
updated sim_linelist to handle and check generalised age-dependent rates
joshwlambert Oct 12, 2023
8ea860a
added .check_rate_df function
joshwlambert Oct 12, 2023
9e4ed4f
only call .add_ct if add_ct = TRUE
joshwlambert Oct 13, 2023
db9e9e1
error if include_contacts = TRUE while WIP
joshwlambert Oct 13, 2023
22246e4
updated .add_names arg in create_contacts
joshwlambert Oct 13, 2023
49f7828
temp branch specific install of epiparameter
joshwlambert Oct 13, 2023
b207d36
add authors to documentation of sim_linelist
joshwlambert Oct 13, 2023
4fce2bd
use <- assignment throughout
joshwlambert Oct 16, 2023
7473042
replace 1:expr with seq_len(expr)
joshwlambert Oct 16, 2023
3724fc5
use TRUE/FALSE over T/F
joshwlambert Oct 16, 2023
b70b951
added nocov and nolint flags to create_contacts while WIP
joshwlambert Oct 16, 2023
f5556df
added nocov flags to dev-utils
joshwlambert Oct 16, 2023
86a6e41
added .create_linelist function for mock testing
joshwlambert Oct 17, 2023
bf650b2
added tests for .create_linelist
joshwlambert Oct 17, 2023
0085355
keep ct in sim_linelist return if add_ct = TRUE
joshwlambert Oct 17, 2023
f62ab19
updated WORDLIST
joshwlambert Oct 17, 2023
3f78a4e
added sim_linelist tests
joshwlambert Oct 17, 2023
3769baa
fixed assignment typo in .add_ct
joshwlambert Oct 17, 2023
34c2627
join by numerics in .add_names
joshwlambert Oct 17, 2023
a0ed143
consistent behaviour and side-effects for add_cols functions
joshwlambert Oct 17, 2023
e0e63b3
added tests for add_cols functions
joshwlambert Oct 17, 2023
be508cf
added tests for checker functions
joshwlambert Oct 17, 2023
34ee344
linting
joshwlambert Oct 17, 2023
480bc40
temp nolint flag until removing NSE permanently from pkg
joshwlambert Oct 17, 2023
a4a1d80
added package logo
joshwlambert Oct 17, 2023
0e03fb2
updated README (badges, quick start, help and citation)
joshwlambert Oct 17, 2023
9f83705
updated WORDLIST
joshwlambert Oct 17, 2023
b396401
Automatic readme update
actions-user Oct 17, 2023
46930ad
only output case names when add_names = TRUE
joshwlambert Oct 17, 2023
3a47d77
updated sim_linelist tests to include case_name and case_type
joshwlambert Oct 17, 2023
d658bf0
added sim_linelist test for add_names = FALSE
joshwlambert Oct 17, 2023
b227572
updated WORDLIST
joshwlambert Oct 17, 2023
9c1db7e
added first draft of getting started vignette
joshwlambert Oct 17, 2023
5327a54
updates to simulist vignette
joshwlambert Oct 19, 2023
e84007b
added bookdown to Suggests
joshwlambert Oct 19, 2023
f5c9a4e
Update CITATION.cff
actions-user Oct 19, 2023
a480e16
added first draft of age-stratified rates vignette
joshwlambert Oct 19, 2023
ff97e3e
added checks to .check_rate_df for overlapping and non-contiguous age…
joshwlambert Oct 19, 2023
2359eba
added tests for .check_rate_df overlapping and non-contiguous age groups
joshwlambert Oct 19, 2023
b8e17dc
add link to age-strat-rates vignette in get started vignette
joshwlambert Oct 19, 2023
af6dd79
updates to age-strat-rates vignette
joshwlambert Oct 19, 2023
ebb2cbb
remove dplyr from Imports
joshwlambert Oct 19, 2023
5f5dd24
replaced dplyr with base R joins
joshwlambert Oct 20, 2023
6ee8e76
Update CITATION.cff
actions-user Oct 20, 2023
5ec9253
Use vectorized randomNames() call
Bisaloo Oct 23, 2023
8f2a1d4
added create_config function
joshwlambert Oct 20, 2023
dd842f9
added tests for create_config
joshwlambert Oct 20, 2023
7296764
added config argument to sim_linelist and use config parameters
joshwlambert Oct 20, 2023
4d3e42f
updated WORDLIST
joshwlambert Oct 20, 2023
d24d830
remove genders from create_config
joshwlambert Oct 20, 2023
1774592
allow multiple distributions for .add_date_first_contact, .add_date_l…
joshwlambert Oct 23, 2023
47c25fc
updated add_cols tests to test for unaccepted distributions
joshwlambert Oct 23, 2023
7937538
test for config inputs in sim_linelist
joshwlambert Oct 23, 2023
b01eee7
ensure arg matching in do.call for add_cols functions
joshwlambert Oct 23, 2023
8793e4d
update create_config with correct arg name
joshwlambert Oct 23, 2023
47df3b0
update and added tests for distribution arg names
joshwlambert Oct 23, 2023
9698f08
linting
joshwlambert Oct 23, 2023
fb3f1c2
add URL and BugReports fields to DESCRIPTION
joshwlambert Oct 24, 2023
7ce2f9c
added Hugo as pkg contributor
joshwlambert Oct 24, 2023
a6f9a9e
Update CITATION.cff
actions-user Oct 24, 2023
f1e0a7c
Update DESCRIPTION
joshwlambert Oct 24, 2023
79763f8
updated create_contacts function to use add_cols functions and added …
joshwlambert Oct 24, 2023
82d031d
subset col by name not index in create_contacts
joshwlambert Oct 24, 2023
ff7d0be
added documentation for create_contacts, added dot prefix for interna…
joshwlambert Oct 24, 2023
79a13d1
added sim_contacts (exported) function
joshwlambert Oct 24, 2023
b2224bd
added tests for sim_contacts
joshwlambert Oct 24, 2023
6a1d616
removed including contacts in sim_linelist
joshwlambert Oct 25, 2023
0d6cb16
removed test that checked include_contacts in sim_linelist
joshwlambert Oct 25, 2023
2e9bb4a
added info on sim_contacts to README and simulist vignette
joshwlambert Oct 25, 2023
091555b
linelist -> line list in text
joshwlambert Oct 25, 2023
eb7f69d
Update CITATION.cff
actions-user Oct 25, 2023
5dfbf33
updated README
joshwlambert Oct 25, 2023
06f8a77
Automatic readme update
actions-user Oct 25, 2023
158321f
moved replicated sim code into sim_utils functions
joshwlambert Oct 25, 2023
b509068
added sim_outbreak (exported) function
joshwlambert Oct 25, 2023
1223772
added tests for sim_outbreak
joshwlambert Oct 25, 2023
08bdcc6
added age-strat rates test for sim_outbreak
joshwlambert Oct 26, 2023
9042004
added sim_outbreak example to README
joshwlambert Oct 26, 2023
4263afe
added sim_outbreak example to simulist vignette
joshwlambert Oct 26, 2023
a634771
Automatic readme update
actions-user Oct 26, 2023
4ca2e27
linting
joshwlambert Oct 26, 2023
8203fab
remove time_rounded col from internal chain object
joshwlambert Oct 26, 2023
6e95e34
removed hosp_rounded col from internal chain object
joshwlambert Oct 26, 2023
8477070
removed death_rounded col from internal chain object
joshwlambert Oct 27, 2023
c5977b7
updated .check_rate_df to use new user input rate df
joshwlambert Oct 27, 2023
a90d3bc
simplify .add_hospitalisation and .add_deaths based on new rate df
joshwlambert Oct 27, 2023
b2323d4
updated sim_linelist documentation for new rate df
joshwlambert Oct 27, 2023
d37a300
updated age-strat-rates vignette with new rates df
joshwlambert Oct 27, 2023
d71520c
use row.names over rownames
joshwlambert Oct 27, 2023
048ef28
updated tests for new rate df
joshwlambert Oct 27, 2023
a5b95a3
added .check_age_df
joshwlambert Oct 30, 2023
49cf009
added tests for .check_age_df
joshwlambert Oct 30, 2023
3a62cd5
updated sim_linelist and .sim_bp_linelist to accommodate age structur…
joshwlambert Oct 30, 2023
94482df
added test for age structured sim_linelist
joshwlambert Oct 30, 2023
42fc87f
changed age_range argument to population_age
joshwlambert Oct 31, 2023
7070761
fix case for age-strat rates and population age structure
joshwlambert Oct 31, 2023
4c2b02f
added test for age-strat rates and age structure
joshwlambert Oct 31, 2023
8a8f077
updated input checking for age structure in sim_outbreak
joshwlambert Oct 31, 2023
cc9d8ca
updated documentation for population_age
joshwlambert Oct 31, 2023
73ac4a9
fixed sim_outbreak .check_rate_df and added nolint for cyclocomp
joshwlambert Oct 31, 2023
fa4bbf2
added ggplot2 to Suggests in DESCRIPTION
joshwlambert Oct 31, 2023
5cfd4fc
added first draft of age-struct-pop vignette
joshwlambert Oct 31, 2023
ddef376
updated simulist vignette to link to age-struct-pop vignette
joshwlambert Oct 31, 2023
dd01f2c
updated WORDLIST
joshwlambert Oct 31, 2023
4bebfa8
updated create_contacts to handle age struct data frame
joshwlambert Oct 31, 2023
d457d64
added sim_outbreak test for age structure
joshwlambert Oct 31, 2023
d298b83
Update CITATION.cff
actions-user Oct 31, 2023
0c828ef
updated yaml settings and added code folding and figure captions for …
joshwlambert Oct 31, 2023
ac61728
updated wording of external links for age pyramids in age-struct-pop …
joshwlambert Oct 31, 2023
9229dbe
normalise sample weights for age sampling
joshwlambert Oct 31, 2023
08adc77
added test to check simulated proportion of ages matches input for si…
joshwlambert Oct 31, 2023
ad40bcd
brackets do not need be escaped in vignette
joshwlambert Nov 1, 2023
4418f90
renamed .create_contacts with .sim_contacts
joshwlambert Nov 1, 2023
6fa521a
include death_date col in line list
joshwlambert Nov 2, 2023
ecb82dd
updated tests to include death_date col
joshwlambert Nov 2, 2023
76ab692
added complete reprex to .create_linelist doc
joshwlambert Nov 2, 2023
4717c9f
updated WORDLIST
joshwlambert Nov 2, 2023
d52dc7c
added first draft of visualisation vignette
joshwlambert Nov 1, 2023
d29c0aa
added interval = "daily" instead of rounding and death_dates in plot …
joshwlambert Nov 2, 2023
a519a03
added min version of incidence2 to DESCRIPTION
joshwlambert Nov 2, 2023
a5d929a
Update CITATION.cff
actions-user Nov 2, 2023
af28cee
added .check_sim_input function
joshwlambert Nov 3, 2023
037e4d6
replaced input checking with .check_sim_input in sim_* functions
joshwlambert Nov 3, 2023
0afecb9
updated .check_sim_input documentation
joshwlambert Nov 3, 2023
d707faf
moved population_age check to all sims in .check_sim_input
joshwlambert Nov 3, 2023
6144131
added tests for .check_sim_input
joshwlambert Nov 3, 2023
b7ef5a0
added epicontacts to Suggests in DESCRIPTION
joshwlambert Nov 3, 2023
681d3d4
renamed part_name and contact_name vars in contact table to from and …
joshwlambert Nov 3, 2023
ba68ed7
updated tests with new contacts col names
joshwlambert Nov 3, 2023
429812b
added first draft of visualising contacts data section to vis-linelis…
joshwlambert Nov 3, 2023
ab8165e
Update CITATION.cff
actions-user Nov 3, 2023
3739d9c
changed output engine in vis-linelist vignette to rmarkdown::html_vig…
joshwlambert Nov 6, 2023
2e6cf9e
minor edits to vis-linelist vignette and added fig.cap labels
joshwlambert Nov 6, 2023
2bc35d8
updated WORDLIST and fixed typos in vis-linelist vignette
joshwlambert Nov 6, 2023
2d4a62b
linting
joshwlambert Nov 6, 2023
b8be92d
added first draft of design-principles vignette
joshwlambert Nov 7, 2023
a7ce825
updated WORDLIST
joshwlambert Nov 7, 2023
6951145
updated website formatting in _pkgdown.yml
joshwlambert Nov 7, 2023
6b94cc1
edits to design-principles vignette
joshwlambert Nov 8, 2023
9ba5d37
match {linelist} tag names to line list col names
joshwlambert Nov 8, 2023
01b69fb
add design decision on linelist tags in design-principles vignette
joshwlambert Nov 9, 2023
e66cfa8
updated WORDLIST
joshwlambert Nov 9, 2023
5e9cc20
renamed .sim_contacts to .sim_contacts_tbl and updated sim_outbreak a…
joshwlambert Nov 10, 2023
3e3ddf2
{styler} run
joshwlambert Nov 10, 2023
d3b05d7
Automatic readme update
actions-user Nov 10, 2023
41967d4
remove branch-specific remote install of epiparameter
joshwlambert Nov 16, 2023
0fe0eba
added .check_func_req_args
joshwlambert Nov 29, 2023
d4421c6
added Pratik as contributor
joshwlambert Nov 29, 2023
da851e5
convert <epidist> to function in exported functions
joshwlambert Nov 29, 2023
1958122
check for functions not epidist in checkers
joshwlambert Nov 29, 2023
d42d3ba
updated internal functions to use distribution functions
joshwlambert Nov 29, 2023
43740a8
added package documentation with func to remove unused imports check …
joshwlambert Nov 29, 2023
9bc2c1c
updated WORDLIST
joshwlambert Nov 29, 2023
4c3f0df
updated tests of internal functions to convert epidist to func
joshwlambert Nov 29, 2023
2139308
add option of anonymous function to function documentation
joshwlambert Nov 29, 2023
5afa173
added section to simulist.Rmd vignette on using anonymous functions
joshwlambert Nov 29, 2023
9a9fef3
added dependency tracker GHA workflow
joshwlambert Nov 30, 2023
e7aff53
fixed typo in sim_linelist tests and rm whitespace from test-sim_cont…
joshwlambert Nov 30, 2023
c1c33f2
updated GHA workflows with merge_groups, error on notes and rebasing
joshwlambert Dec 1, 2023
52af940
added link to package documentation file
joshwlambert Dec 1, 2023
b0b51d7
added nolint flag check to release_bullets
joshwlambert Dec 1, 2023
bd77c21
added helper state check to tests and turned off stop_on_warning
joshwlambert Dec 1, 2023
c0e76a7
added check.env file
joshwlambert Dec 1, 2023
2a3b6a1
added tools to .Rbuildignore
joshwlambert Dec 1, 2023
e1331ce
run tests in parallel
joshwlambert Dec 1, 2023
349a804
updated copyright holder in license files
joshwlambert Dec 1, 2023
240e766
updated .lintr
joshwlambert Dec 1, 2023
6c89a7a
updated WORDLIST
joshwlambert Dec 1, 2023
533b1d1
added nolint flag for mapply call
joshwlambert Dec 1, 2023
4e6748d
added NEWS.md and draft of v0.1.0 release notes
joshwlambert Dec 1, 2023
ea8ff64
Automatic readme update
actions-user Dec 1, 2023
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
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
^.*\.Rproj$
^\.Rproj\.user$
^CITATION\.cff$
^doc$
^Meta$
^tools$
2 changes: 2 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
- 'LICENSE'
- '.Rbuildignore'
- '.github/workflows/R-CMD-check.yaml'
merge_group:
pull_request:
paths:
- 'data/**'
Expand Down Expand Up @@ -85,6 +86,7 @@ jobs:
id: rcmdcheck
with:
upload-snapshots: true
error-on: '"note"'

# fail-fast but only if rcmdcheck step fails
- name: Manual fail-fast
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/dependency-change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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
on:
pull_request:
paths:
- 'DESCRIPTION'

name: Analyze dependency changes

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

jobs:
dependency-changes:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
pull-requests:
write
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...")

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",
"",
"(Note that results may be inacurrate 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
)

}
3 changes: 2 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- 'DESCRIPTION'
- '.Rbuildignore'
- '.github/**'
merge_group:
pull_request:
paths:
- 'README.Rmd'
Expand Down Expand Up @@ -70,7 +71,7 @@ jobs:
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
if: github.event_name != 'merge_group' && github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
# We clean on releases because we want to remove old vignettes,
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/render_readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ name: render-readme
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'
Expand Down Expand Up @@ -85,4 +89,5 @@ jobs:
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"
1 change: 1 addition & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- 'inst/**'
- 'DESCRIPTION'
- '.github/workflows/test-coverage.yaml'
merge_group:
pull_request:
paths:
- 'R/**'
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/update-citation-cff.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# 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:
# This may seem like a no-op but it prevents triggering on tags.
# We use '**' rather '*' to accomodate names like 'dev/branch-1'
- '**'
paths:
- DESCRIPTION
- inst/CITATION
Expand Down Expand Up @@ -52,4 +53,5 @@ jobs:
git config --local user.name "GitHub Action"
git add CITATION.cff
git commit -m 'Update CITATION.cff' || echo "No changes to commit"
git pull --rebase origin ${{ github.ref.name }}
git push origin || echo "No changes to commit"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ rsconnect/

# macOS hidden files
.DS_Store
inst/doc
/doc/
/Meta/
29 changes: 25 additions & 4 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
linters: linters_with_tags(
tags = NULL, # include all linters
linters: all_linters(
packages = c("lintr", "etdev"),
object_name_linter = NULL,
undesirable_function_linter = NULL,
implicit_integer_linter = NULL,
extraction_operator_linter = NULL,
todo_comment_linter = NULL,
undesirable_function_linter(
modify_defaults(
default_undesirable_functions,
citEntry = "use the more modern bibentry() function",
library = NULL # too many false positive in too many files
)
),
function_argument_linter = NULL,
indentation_linter = NULL, # unstable as of lintr 3.1.0
# Use minimum R declared in DESCRIPTION or fall back to current R version.
# Install etdev package from https://github.com/epiverse-trace/etdev
backport_linter(if (length(x <- etdev::extract_min_r_version())) x else getRversion())
)
exclusions: list(
"tests/testthat.R" = list(unused_import_linter = Inf)
"tests/testthat.R" = list(
unused_import_linter = Inf
),
"tests" = list(
undesirable_function_linter = Inf
),
"data-raw" = list(
missing_package_linter = Inf,
namespace_linter = Inf
),
# RcppExports.R is auto-generated and will not pass many linters. In
# particular, it can create very long lines.
"R/RcppExports.R",
# R/stanmodels.R is auto-generated and will not pass many linters. In
# particular, it uses `sapply()`.
"R/stanmodels.R"
)
Loading
Loading