Skip to content

Commit

Permalink
keep row.names but make them unique, in case first object has them.
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Feb 5, 2016
1 parent 0338cdb commit 1e1e9f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/rbind.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ rbind.SpatialPoints <- function(...) {
dots = list(...)
names(dots) <- NULL
stopifnot(identicalCRS(dots))
dropRowNames = is.null(dimnames(dots[[1]]@coords)[[1]]) # or check each of them?
coordinates.strip = function(x) {
x = coordinates(x)
row.names(x) = NULL
x
}
SpatialPoints(do.call(rbind, lapply(dots, coordinates.strip)),
ret = SpatialPoints(do.call(rbind, lapply(dots, coordinates.strip)),
CRS(proj4string(dots[[1]])))
if (!dropRowNames)
row.names(ret) = make.unique(do.call(c, lapply(dots, row.names)))
ret
}

rbind.SpatialPointsDataFrame <- function(...) {
Expand Down

0 comments on commit 1e1e9f0

Please sign in to comment.