Skip to content

Commit 46fc474

Browse files
committed
Only drop NA weights if na.rm = T.
1 parent f634475 commit 46fc474

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

R/aggregate_grid_to_polygons.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,10 @@ aggregate_draws_to_polygons <- function(
474474
} else {
475475
stop("ISSUE: Weighting raster has a different number of layers from data raster.")
476476
}
477+
if(na.rm){
478+
# Change NA weights to 0
479+
draws_table[is.na(w__), w__ := 0.0]
480+
}
477481
} else {
478482
draws_table$w__ <- 1L
479483
}

0 commit comments

Comments
 (0)