Skip to content

Commit

Permalink
Style code (GHA)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwillem committed Dec 20, 2024
1 parent 84603aa commit 3d18bf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions R/contact_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ contact_matrix <- function(survey, countries = NULL, survey.pop, age.limits, fil

# remove contact ages below the age limit, before dealing with missing contact ages
survey$contacts <- survey$contacts[is.na(cnt_age) |
cnt_age >= min(age.limits), ]
cnt_age >= min(age.limits), ]

if (missing.contact.age == "remove" &&
nrow(survey$contacts[is.na(cnt_age)]) > 0) {
if (!missing.contact.age.set) {
Expand Down
12 changes: 4 additions & 8 deletions tests/testthat/test-matrix.r
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,8 @@ test_that("Symmetric contact matrices with large normalisation weights throw a w
})

test_that("Contacts with an age below the age limits are excluded regardless of the missing.contact.age setting", {
expect_equal(ncol(contact_matrix(polymod,age.limits = c(10,50), missing.contact.age = 'remove')$matrix), 2)
expect_equal(ncol(contact_matrix(polymod,age.limits = c(10,50), missing.contact.age = 'sample')$matrix), 2)
expect_equal(ncol(contact_matrix(polymod,age.limits = c(10,50), missing.contact.age = 'keep')$matrix), 3) # extra column for ages outside age limits (= NA)
expect_equal(ncol(contact_matrix(polymod,age.limits = c(10,50), missing.contact.age = 'ignore')$matrix), 2)
expect_equal(ncol(contact_matrix(polymod, age.limits = c(10, 50), missing.contact.age = "remove")$matrix), 2)

Check warning on line 560 in tests/testthat/test-matrix.r

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=tests/testthat/test-matrix.r,line=560,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
expect_equal(ncol(contact_matrix(polymod, age.limits = c(10, 50), missing.contact.age = "sample")$matrix), 2)

Check warning on line 561 in tests/testthat/test-matrix.r

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=tests/testthat/test-matrix.r,line=561,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
expect_equal(ncol(contact_matrix(polymod, age.limits = c(10, 50), missing.contact.age = "keep")$matrix), 3) # extra column for ages outside age limits (= NA)

Check warning on line 562 in tests/testthat/test-matrix.r

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=tests/testthat/test-matrix.r,line=562,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
expect_equal(ncol(contact_matrix(polymod, age.limits = c(10, 50), missing.contact.age = "ignore")$matrix), 2)

Check warning on line 563 in tests/testthat/test-matrix.r

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=tests/testthat/test-matrix.r,line=563,col=3,[expect_identical_linter] Use expect_identical(x, y) by default; resort to expect_equal() only when needed, e.g. when setting ignore_attr= or tolerance=.
})




0 comments on commit 3d18bf3

Please sign in to comment.