Skip to content

Commit

Permalink
fixed a bug in cost_to_closest()
Browse files Browse the repository at this point in the history
  • Loading branch information
dhersz committed Oct 6, 2022
1 parent fbe6819 commit dc65f17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## Bug fixes

- Fixed a bug in which `cost_to_closest()` would return `NA` values when
filling missing ids (which should be filled with `Inf`, since they cannot
reach any opportunities). This was also responsible for the warning reported
in #27, which was also fixed.

## Notes

# accessibility 1.0.0
Expand Down
2 changes: 2 additions & 0 deletions R/cost_to_closest.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ cost_to_closest <- function(travel_matrix,
possible_combinations <- do.call(data.table::CJ, unique_values)

if (nrow(access) < nrow(possible_combinations)) {
access[, min_cost := as.numeric(min_cost)]

access <- do_fill_missing_ids(
access,
possible_combinations,
Expand Down

0 comments on commit dc65f17

Please sign in to comment.