Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 signature 'STIDF'
x[i, j, ..., drop = FALSE]
  ## S4 method for signature '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

Note

arguments sp, time and data need to have the same number of records, and regardless of the class of time (xts or POSIXct) have to be in correspoinding order: the triple sp[i], time[i] and data[i,] refer to the same observation

Author(s)

References

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

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)
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,])

spacetime

Classes and Methods for Spatio-Temporal Data

v1.2-4
GPL (>= 2)
Authors
Edzer Pebesma [aut, cre] (<https://orcid.org/0000-0001-8049-7069>), Benedikt Graeler [ctb], Tom Gottfried [ctb], Robert J. Hijmans [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.