Description Usage Arguments Value Author(s) See Also Examples
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.
1 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.