stCheckCovars {SpatioTemporal} | R Documentation |
Checks that data.frame of covariates is valid, making sure that all
locations specified in ID.unique
exist. The function will attempt
to name each row in covars
using 1) covars$ID
, 2)
rownames(covars)
, and 3) as.character(1:dim(covars)[1])
.
The field covars$ID
is added if missing and rownames
are removed.
stCheckCovars(covars, ID.unique = character(0))
covars |
data.frame containing covariates, to be checked. |
ID.unique |
vector with unique IDs that HAVE to be present in the covariates, typically the observation locations. |
Updated covars
data.frame.
Johan Lindstrom
Other object checking utilities: stCheckClass
,
stCheckFields
, stCheckObs
,
stCheckSTcovars
##load data data(mesa.model) ##check covariates tmp <- stCheckCovars( mesa.model$locations, mesa.model$locations$ID ) str(tmp) ##require non-existant site try( stCheckCovars( mesa.model$locations, "Bad.Site" ) ) ##drop the ID mesa.model$locations$ID <- NULL tmp <- stCheckCovars( mesa.model$locations ) ##ID:s infered from rownames (1-25) str(tmp)