Learn R Programming

SpatioTemporal (version 0.9.2)

combineMesaData: Merges two Data Objects.

Description

Function that merges a mesa.data.model with a mesa.data, creating a new mesa.data.model object that combines the locations from both input objects.

This function is mainly for internal use.

Usage

combineMesaData(mesa.data.model, mesa.data)

Arguments

mesa.data.model
Data structure holding locations, covariates, temporal trends, and observations. See further mesa.data.model.
mesa.data
Data structure holding additional locations, geographic covariates, and spatio-temporal covariates, smooth temporal trends, and optionally additional observations. See further mesa.data

Value

encoding

latin1

Details

Function that combines locations in mesa.data.model and mesa.data creating a new mesa.data.model object. The temporal trend and observations are taken from mesa.data.model. Any trend and/or observation data in mesa.data are ignored. This function is used internally by cond.expectation and simulateMesaData.

See Also

Used by cond.expectation and simulateMesaData.

Examples

Run this code
##load the data
data(mesa.data)
data(mesa.data.model)

##keep only observations from the AQS sites
ID.AQS <- mesa.data$location$ID[mesa.data$location$type=="AQS"]
mesa.data$obs <- mesa.data$obs[mesa.data$obs$ID %in% ID.AQS,]

##keep the original mesa.data.model
mesa.data.model.org <- mesa.data.model

##and create a model object, dropping unobserved locations.
mesa.data.model <- create.data.model(mesa.data,
    LUR = mesa.data.model$LUR.list, ST.Ind = mesa.data.model$ST.Ind)

##lets study the number of sites and observations in each object
printMesaDataNbrObs(mesa.data)
printMesaDataNbrObs(mesa.data.model)
printMesaDataNbrObs(mesa.data.model.org)

##combine mesa.data and mesa.data.model
printMesaDataNbrObs(combineMesaData(mesa.data.model, mesa.data))
##adding the 5 FIXED sites dropped by create.data.model

##combining mesa.data.model.org and mesa.data produces a warning
##since mesa.data contains no new sites.
tmp <- combineMesaData(mesa.data.model.org, mesa.data)

Run the code above in your browser using DataLab