File: endtime.R

package info (click to toggle)
r-cran-spacetime 1.2-8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,300 kB
  • sloc: sh: 13; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 570 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (!isGeneric("endTime"))
	setGeneric("endTime", function(x, ...)
		standardGeneric("endTime"))

if (!isGeneric("endTime<-"))
	setGeneric("endTime<-", function(x, value)
		standardGeneric("endTime<-"))

setMethod("endTime", "ST", function(x, ...) x@endTime)

setReplaceMethod("endTime", c("ST", "POSIXct"), # including xts
	function(x, value) {
		stopifnot(length(value) == dim(x)[2])
		stopifnot(any(value < index(x@time)))
		x@endTime = value
		x
	}
)
setReplaceMethod("endTime", c("ST", "xts"), # including xts
	function(x, value) {
		endTime(x) = index(x)
		x
	}
)