Skip to content

Commit 1e1e9f0

Browse files
committed
keep row.names but make them unique, in case first object has them.
1 parent 0338cdb commit 1e1e9f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/rbind.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ rbind.SpatialPoints <- function(...) {
1212
dots = list(...)
1313
names(dots) <- NULL
1414
stopifnot(identicalCRS(dots))
15+
dropRowNames = is.null(dimnames(dots[[1]]@coords)[[1]]) # or check each of them?
1516
coordinates.strip = function(x) {
1617
x = coordinates(x)
1718
row.names(x) = NULL
1819
x
1920
}
20-
SpatialPoints(do.call(rbind, lapply(dots, coordinates.strip)),
21+
ret = SpatialPoints(do.call(rbind, lapply(dots, coordinates.strip)),
2122
CRS(proj4string(dots[[1]])))
23+
if (!dropRowNames)
24+
row.names(ret) = make.unique(do.call(c, lapply(dots, row.names)))
25+
ret
2226
}
2327

2428
rbind.SpatialPointsDataFrame <- function(...) {

0 commit comments

Comments
 (0)