Skip to content

Commit 430b65c

Browse files
committed
fixes #1886
1 parent 37b36a4 commit 430b65c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# version 1.0-13
22

3+
* `select.sf()` allows selecting the same column twice under different names; #1886
4+
35
* `st_as_sf.ppplist()` is deprecated; #1926
46

57
* `st_cast()` handles empty geometries; #1961

R/tidyverse.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ select.sf <- function(.data, ...) {
162162
stop("internal error: can't find sf column") # nocov
163163

164164
agr = st_agr(.data)
165-
vars = names(.data)[setdiff(loc, sf_column_loc)]
165+
#vars = names(.data)[setdiff(loc, sf_column_loc)] # see #1886, change into:
166+
lloc = loc
167+
if (sf_column_loc %in% loc)
168+
lloc = lloc[loc != sf_column_loc]
169+
vars = names(.data)[lloc]
166170

167171
sf_column_loc_loc = match(sf_column_loc, loc)
168172
if (is.na(sf_column_loc_loc)) {

0 commit comments

Comments
 (0)