Skip to content

Commit

Permalink
set operations should sort neighbour indices
Browse files Browse the repository at this point in the history
  • Loading branch information
rsbivand committed Jun 14, 2024
1 parent 3d5617d commit b92b868
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/utils-set-operations.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#' @export
nb_union <- function(x, y) {
res <- mapply(union, x, y, SIMPLIFY = FALSE)
res <- lapply(res, sort)
res <- fill_missing_nb(res)
class_modify(res, "nb")
}
Expand All @@ -32,6 +33,7 @@ nb_union <- function(x, y) {
#' @export
nb_intersect <- function(x, y) {
res <- mapply(intersect, x, y, SIMPLIFY = FALSE)
res <- lapply(res, sort)
res <- fill_missing_nb(res)
class_modify(res, "nb")
}
Expand All @@ -40,6 +42,7 @@ nb_intersect <- function(x, y) {
#' @export
nb_setdiff <- function(x, y) {
res <- mapply(setdiff, x, y, SIMPLIFY = FALSE)
res <- lapply(res, sort)
res <- fill_missing_nb(res)
class_modify(res, "nb")
}
Expand Down

0 comments on commit b92b868

Please sign in to comment.