Skip to content

Commit

Permalink
fixes #2261
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Nov 10, 2023
1 parent b595dac commit 6e39d6d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/tidyverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ rename_with.sf = function(.data, .fn, .cols, ...) {
if (!requireNamespace("rlang", quietly = TRUE))
stop("rlang required: install that first") # nocov
.fn = rlang::as_function(.fn)
is_tibble = inherits(.data, "tbl")

sf_column = attr(.data, "sf_column")
sf_column_loc = match(sf_column, names(.data))
Expand Down Expand Up @@ -264,6 +265,8 @@ rename_with.sf = function(.data, .fn, .cols, ...) {
...
)
}
if (is_tibble)
ret = dplyr::as_tibble(ret)
ret = st_as_sf(ret, sf_column_name = names(ret)[sf_column_loc])

names(agr) = .fn(names(agr))
Expand Down

0 comments on commit 6e39d6d

Please sign in to comment.