createDataMatrix: Create a Data Matrix

Description Usage Arguments Value Author(s) See Also Examples

Description

Creates a data matrix from a STdata/STmodel object. Missing observations are marked as NA.

Usage

1
2
createDataMatrix(STdata = NULL, obs = STdata$obs$obs,
  date = STdata$obs$date, ID = STdata$obs$ID, subset = NULL)

Arguments

STdata

A STdata/STmodel object containing observations. Use either this or the obs, date, and ID inputs.

obs

A vector of observations.

date

A vector of observation times.

ID

A vector of observation locations.

subset

A subset of locations to extract the data matrix for. A warning is given for each name not found in ID.

Value

Returns a matrix with dimensions (number of timepoints)-by-(number of locations). Row and column names of the matrix are taken as ID and sort(unique(date)) respectively.

Author(s)

Johan Lindstrom

See Also

Other data matrix: SVDmiss, SVDsmooth, estimateBetaFields, mesa.data.raw

Other STdata functions: c.STmodel, createSTdata, createSTmodel, detrendSTdata, estimateBetaFields, removeSTcovarMean, updateTrend.STdata

Other STmodel functions: createCV, createSTmodel, dropObservations, estimateBetaFields, loglikeSTdim, loglikeST, predictNaive, processLUR, processLocation, updateCovf, updateTrend.STdata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
##load the data
data(mesa.model)

##create a data matrix
M1 <- createDataMatrix(mesa.model)
dim(M1)
head(M1)

##create data matrix for only a few locations
M2 <- createDataMatrix(mesa.model, subset =
                         c("60370002","60370016","60370113","60371002",
                           "60371103","60371201","L001","L002"))
dim(M2)
head(M2)

SpatioTemporal documentation built on May 2, 2019, 8:49 a.m.