Skip to content

Commit

Permalink
Merge pull request #155 from mrc-ide/durations_together
Browse files Browse the repository at this point in the history
v0.5.5 population$n as integer.
  • Loading branch information
OJWatson authored Nov 25, 2020
2 parents 9de967f + 1c55b96 commit 8d0e69e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: squire
Type: Package
Title: SEIR transmission model of COVID-19
Version: 0.5.4
Version: 0.5.5
Authors@R: c(
person("OJ", "Watson", email = "o.watson15@imperial.ac.uk", role = c("aut", "cre")),
person("Patrick", "Walker", email = "patrick.walker06@imperial.ac.uk", role = c("aut")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# squire 0.5.5

* `population$n` are all integer class

# squire 0.5.4

* `beta_est` accepts apothecary models
Expand Down
3 changes: 2 additions & 1 deletion data-raw/prepare_raw_data.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Process raw data
library(tidyverse)

# Contact Matrices sourced from literature used in the global report
# ------------------------------------------------------------------------------
Expand All @@ -18,7 +19,7 @@ population <- demog %>%
tidyr::pivot_longer(cols = -country, names_to = "age_group", values_to = "n",
names_prefix = "X") %>%
dplyr::mutate(age_group = stringr::str_replace(age_group, "[.]", "-"),
n = round(n * 1000))
n = as.integer(round(n * 1000)))

population$age_group <- factor(population$age_group, levels = c("0-4",
"5-9",
Expand Down
Binary file modified data/population.rda
Binary file not shown.
9 changes: 9 additions & 0 deletions tests/testthat/test-population.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,12 @@ test_that("durations", {
names(squire:::default_durations())))

})



test_that("population n are all integers", {

int_log <- vapply(population$n, is.integer, logical(1))
expect_true(sum(int_log) == length(population$n))

})

0 comments on commit 8d0e69e

Please sign in to comment.