File: Class-SpatialPointsDataFrame.R

package info (click to toggle)
r-cran-sp 1%3A1.4-5-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,328 kB
  • sloc: ansic: 1,108; sh: 14; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 717 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
setClass("SpatialPointsDataFrame",
	contains = "SpatialPoints", 
	slots = c(data = "data.frame", coords.nrs = "numeric"),
	prototype = list(bbox = matrix(NA), proj4string = CRS(as.character(NA)),
		coords = matrix(NA), data = data.frame(), 
		coords.nrs = numeric(0)),
	validity = function(object) {
		# if (ncol(object@data) == 0)
		# 	stop("data.frame is empty (possibly after stripping coordinate columns): use SpatialPoints() to create points-only object")
		if (nrow(object@data) != nrow(object@coords))
			return("number of rows in data.frame and SpatialPoints don't match")
		n <- length(object@coords.nrs)
		if (n > 0 && n != ncol(object@coords))
			return("inconsistent coords.nrs slot")
		return(TRUE)
	}
)