Skip to content

Commit 4ecabf0

Browse files
committed
keep crs in dplyr::filter
address #2059 (comment)
1 parent 1bcce69 commit 4ecabf0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/tidyverse.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ filter.sf <- function(.data, ..., .dots) {
5656
class(.data) <- setdiff(class(.data), "sf")
5757
if (inherits(g, "sfc_POINT") && !is.null(pts <- attr(g, "points"))) {
5858
.data[[ attr(.data, "sf_column") ]] = pts
59-
st_as_sf(NextMethod(), coords = attr(.data, "sf_column"), agr = agr, remove = FALSE) # FIXME: doesn't handle tibble?
59+
st_as_sf(NextMethod(), coords = attr(.data, "sf_column"), agr = agr, remove = FALSE,
60+
crs = st_crs(g)) # FIXME: doesn't handle tibble?
6061
} else
6162
.re_sf(NextMethod(), sf_column_name = attr(.data, "sf_column"), agr)
6263
}

0 commit comments

Comments
 (0)