STSDF-class: Class "STSDF"

STSDF-classR Documentation

Class "STSDF"

Description

A class for spatio-temporal data with partial space-time grids; for n spatial locations and m times, an index table is kept for which nodes observations are available

Usage

  STS(sp, time, index, endTime = delta(time))
  STSDF(sp, time, data, index, endTime = delta(time))
  ## S4 method for signature 'STSDF'
x[i, j, ..., drop = is(x, "STSDF")]
  ## S4 method for signature 'STSDF,STFDF'
coerce(from, to, strict=TRUE)
  ## S4 method for signature 'STSDF,STIDF'
coerce(from, to, strict=TRUE)

Arguments

sp

object of class Spatial

time

object holding time information; see ST-class

data

data frame with rows corresponding to the observations (spatial index moving faster than temporal)

index

two-column matrix: rows corresponding to the nodes for which observations are available, first column giving spatial index, second column giving temporal index

endTime

vector of class POSIXct with end points of time intervals for the observations

x

an object of class STFDF

i

selection of spatial entities

j

selection of temporal entities (see syntax in package xts)

...

selection of attribute(s)

drop

if TRUE and a single spatial entity is selected, an object of class xts is returned; if TRUE and a single temporal entity is selected, and object of the appropriate Spatial class is returned; if FALSE, no coercion to reduced classes takes place

from

object of class STFDF

to

target class

strict

ignored

Objects from the Class

Objects of this class carry sparse space/time grid data

Slots

sp:

Object of class "Spatial"

time:

Object holding time information; see ST-class for permitted types

index:

matrix of dimension n x 2, where n matches the number of rows in slot data

data:

Object of class data.frame, which holds the measured values

Methods

[

signature(x = "STSDF"): selects spatial entities, temporal entities, and attributes

plot

signature(x = "STS", y = "missing"): plots space-time layout

plot

signature(x = "STSDF", y = "missing"): plots space-time layout, indicating records partially NA

Author(s)

Edzer Pebesma, edzer.pebesma@uni-muenster.de

References

https://www.jstatsoft.org/v51/i07/

See Also

delta

Examples

sp = cbind(x = c(0,0,1), y = c(0,1,1))
row.names(sp) = paste("point", 1:nrow(sp), sep="")
library(sp)
sp = SpatialPoints(sp)
library(xts)
time = xts(1:4, as.POSIXct("2010-08-05")+3600*(10:13))
m = c(10,20,30) # means for each of the 3 point locations
mydata = rnorm(length(sp)*length(time),mean=rep(m, 4))
IDs = paste("ID",1:length(mydata))
mydata = data.frame(values = signif(mydata,3), ID=IDs)
stfdf = STFDF(sp, time, mydata)
stfdf
stsdf = as(stfdf, "STSDF")
stsdf[1:2,]
stsdf[,1:2]
stsdf[,,2]
stsdf[,,"values"]
stsdf[1,]
stsdf[,2]
# examples for [[, [[<-, $ and $<- 
stsdf[[1]]
stsdf[["values"]]
stsdf[["newVal"]] <- rnorm(12)
stsdf$ID
stsdf$ID = paste("OldIDs", 1:12, sep="")
stsdf$NewID = paste("NewIDs", 12:1, sep="")
stsdf
x = stsdf[stsdf,]
x = stsdf[stsdf[1:2,],]
all.equal(x, stsdf[1:2,])

spacetime documentation built on April 6, 2023, 1:09 a.m.