Skip to content

Commit

Permalink
Fix issues with NA values in population
Browse files Browse the repository at this point in the history
  • Loading branch information
mengqi-z committed Jul 19, 2024
1 parent ffef70d commit 14947a3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vignettes/*.pdf

# R Environment Variables
.Renviron
output
output*
inst/doc
docs/
tests/testthat/output/
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Remotes:
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
3 changes: 2 additions & 1 deletion R/hdcd.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ hdcd <- function(ncdf = NULL,

population_j_weighted <- population_j_grid %>%
dplyr::group_by(region, ID, subRegion, year) %>%
dplyr::mutate(subRegion_total_value = sum(value, na.rm = T)) %>%
dplyr::mutate(subRegion_total_value = sum(value, na.rm = T),
value = ifelse(is.na(value), 0, value)) %>%
dplyr::ungroup() %>%
dplyr::mutate(pop_weight = value / subRegion_total_value)

Expand Down
20 changes: 20 additions & 0 deletions man/helios.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14947a3

Please sign in to comment.