Skip to content

Commit

Permalink
keep crs in dplyr::filter
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Aug 30, 2023
1 parent 1bcce69 commit 4ecabf0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/tidyverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ filter.sf <- function(.data, ..., .dots) {
class(.data) <- setdiff(class(.data), "sf")
if (inherits(g, "sfc_POINT") && !is.null(pts <- attr(g, "points"))) {
.data[[ attr(.data, "sf_column") ]] = pts
st_as_sf(NextMethod(), coords = attr(.data, "sf_column"), agr = agr, remove = FALSE) # FIXME: doesn't handle tibble?
st_as_sf(NextMethod(), coords = attr(.data, "sf_column"), agr = agr, remove = FALSE,
crs = st_crs(g)) # FIXME: doesn't handle tibble?
} else
.re_sf(NextMethod(), sf_column_name = attr(.data, "sf_column"), agr)
}
Expand Down

0 comments on commit 4ecabf0

Please sign in to comment.