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

remove missing population data #127

Merged
merged 1 commit into from
Sep 11, 2024
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 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