Learn R Programming

SpatioTemporal (version 1.1.7)

stCheckSTcovars: Check an Array/List of Spatio-Temporal Covariates

Description

Checks that array/list of spatio-temporal covariates is valid, making sure that at least all locations specified in ID.unique exist. The function will attempt to name extract locations ID's from colnames(ST) and observation dates from rownames(ST) (using convertCharToDate).

Usage

stCheckSTcovars(ST, ID.unique = character(0),
    date.unique = integer(0))

Arguments

ST

A 3D-array containing the ST-covariates, or a list of array:s, the list elements have to be of matching sizes and have the same rownames and colnames; list elemets are stacked to form a 3D-array.

date.unique

vector with unique dates/times that HAVE to be present in the ST-covariates, typically the observation time-points.

ID.unique

vector with unique IDs that HAVE to be present in the ST-covariates, typically the observation locations and un-observation locations for predictions

Value

Updated ST array

See Also

Other object checking utilities: stCheckClass, stCheckCovars, stCheckFields, stCheckObs

Examples

Run this code
# NOT RUN {
##load data
  data(mesa.model)

  ##check covariates
  tmp <- stCheckSTcovars( mesa.model$ST.all, mesa.model$locations$ID )
  str(tmp)
  ##require non-existant site
  try( stCheckSTcovars( mesa.model$ST.all, "Bad.Site" ) )
  ##require non-existant site
  try( stCheckSTcovars( mesa.model$ST.all, date.unique=1 ) )
# }

Run the code above in your browser using DataLab