Skip to content

Commit

Permalink
remove missing population data
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Sep 11, 2024
1 parent 25d5e22 commit 3400e32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# socialmixr (development version)

* The speed of loading surveys has been increased.
* An error has been fixed causing NA contact matrices if any 5-year age band in the population data was missing.

# socialmixr 0.3.2

Expand Down
2 changes: 2 additions & 0 deletions R/contact_matrix.r
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ contact_matrix <- function(survey, countries = NULL, survey.pop, age.limits, fil

# add upper.age.limit after sorting the survey.pop ages (and add maximum age > given ages)
survey.pop <- survey.pop[order(lower.age.limit), ]
# if any lower age limits are missing remove them
survey.pop <- survey.pop[!is.na(population)]
survey.pop$upper.age.limit <- unlist(c(
survey.pop[-1, "lower.age.limit"],
1 + max(
Expand Down

0 comments on commit 3400e32

Please sign in to comment.