[go: up one dir, main page]

File: Class-STSDF.R

package info (click to toggle)
r-cran-spacetime 1.3-3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,240 kB
  • sloc: sh: 13; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 876 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
setClass("STS", # space-time partial 
  contains = "ST", 
  slots = c(index = "matrix"),
  validity = function(object) {
    stopifnot(ncol(object@index) == 2)
	ix = unique(object@index[,1]) # space
	stopifnot(min(ix) >= 1 && max(ix) <= length(object@sp))
	ix = unique(object@index[,2]) # time
	stopifnot(min(ix) >= 1 && max(ix) <= nrow(object@time))
	return(TRUE)
  }
)

setClass("STSDF", # space-time partial data frame
  contains = "STS", 
  slots = c(data = "data.frame"),
  validity = function(object) {
	stopifnot(nrow(object@index) == nrow(object@data))
    #stopifnot(ncol(object@index) == 2)
	#ix = unique(object@index[,1]) # space
	#stopifnot(min(ix) >= 1 && max(ix) <= length(object@sp))
	#ix = unique(object@index[,2]) # time
	#stopifnot(min(ix) >= 1 && max(ix) <= nrow(object@time))
    .checkAttrIsUnique(object@sp, object@time, object@data)
	return(TRUE)
  }
)