Learn R Programming

SpatioTemporal (version 1.1.7)

stCheckObs: Check an obs data.frame.

Description

Checks that a observation data.frame is valid.

Usage

stCheckObs(obs)

Arguments

obs

data.frame to be checked.

Value

Nothing

Details

A valid observation data.frame needs to fullfill:

  • Contains fields obs, date, and ID

  • All elements in obs$obs are finte

  • obs$date is one of Date, numeric, or integer

  • obs$ID is character

  • No duplicated observations (same ID and date)

See Also

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

Examples

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

  ##check observations
  stCheckObs( mesa.model$obs )
  ##some possible failures
  mesa.model$obs <- rbind(mesa.model$obs, mesa.model$obs[1,])
  try( stCheckObs( mesa.model$obs ) )
  mesa.model$obs$obs[1] <- NaN
  try( stCheckObs( mesa.model$obs ) )
  mesa.model$obs$date <- as.character( mesa.model$obs$date )
  try( stCheckObs( mesa.model$obs ) )
  mesa.model$obs$date <- NULL
  try( stCheckObs( mesa.model$obs ) )
# }

Run the code above in your browser using DataLab