| 1 |
setClass("SpatialPointsDataFrame", |
| 2 |
contains = "SpatialPoints", |
| 3 |
slots = c(data = "data.frame", coords.nrs = "numeric"), |
| 4 |
prototype = list(bbox = matrix(NA), proj4string = CRS(as.character(NA)), |
| 5 |
coords = matrix(NA), data = data.frame(), |
| 6 |
coords.nrs = numeric(0)), |
| 7 |
validity = function(object) { |
| 8 |
# if (ncol(object@data) == 0) |
| 9 |
# stop("data.frame is empty (possibly after stripping coordinate columns): use SpatialPoints() to create points-only object") |
| 10 |
if (nrow(object@data) != nrow(object@coords)) |
| 11 |
return("number of rows in data.frame and SpatialPoints don't match") |
| 12 |
n <- length([email protected]) |
| 13 |
if (n > 0 && n != ncol(object@coords)) |
| 14 |
return("inconsistent coords.nrs slot") |
| 15 |
return(TRUE) |
| 16 |
} |
| 17 |
) |