Learn R Programming

spacetime (version 1.2-2)

STIDF-class: Class "STIDF"

Description

A class for unstructured spatio-temporal data; for n spatial locations and times, n observations are available

Usage

STI(sp, time, endTime)
  STIDF(sp, time, data, endTime)
  # S4 method for STIDF
[(x, i, j, ..., drop = FALSE)
  # S4 method for STIDF,STSDF
coerce(from, to, strict=TRUE)

Arguments

sp

object of class Spatial

time

object holding time information; when STIDF is called, a non-ordered vector with times, e.g. POSIXct will also work, and rearrange the sp and data slots according to the ordering of time; for this to work no ties should exist.

endTime

vector of class POSIXct, indicating the end points of time intervals for the observations. By default, for STI objects time is taken, indicating that time intervals have zero width (time instances)

data

data frame with appropriate number of rows

x

an object of class STFDF

i

selection of record index (spatial/temporal/spatio-temporal entities)

j

or character string with temporal selection

...

first element is taken as column (variable) selector

drop

if TRUE and a single spatial entity is selected, an object of class xts is returned (NOT yet implemented); 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 full space/time grid data

Slots

sp:

Object of class "Spatial"

time:

Object holding time information, see ST-class

data:

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

Methods

[

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

% \item{plot}{\code{signature(x = "Spatial", y = "missing")}: plot method % for spatial objects; does nothing but setting up a plotting region choosing % a suitable aspect if not given(see below), colouring the plot background using either a bg= argument or par("bg"), and possibly drawing axes. } % \item{summary}{\code{signature(object = "Spatial")}: summarize object}

References

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

Examples

Run this code
# NOT RUN {
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)
time = 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)
stidf = as(STFDF(sp, time, mydata), "STIDF")
stidf[1:2,]
all.equal(stidf, stidf[stidf,])
# }

Run the code above in your browser using DataLab