stCheckClass {SpatioTemporal} | R Documentation

## Test if an object belongs to given class(es).

### Description

Test if an object belongs to given class(es), and produce reasonable error message if not.

### Usage

    stCheckClass(x, what, name = "Object")

### Arguments

`x` | Object to test.
`what` | A character vector naming classes.
`name` | Character string to be pasted into the error message describing `x`.

### Value

Nothing

### Author(s)

Johan Lindstrom

### See Also

Similar to `inherits`

Other object checking utilities: `stCheckCovars`, `stCheckFields`, `stCheckObs`, `stCheckSTcovars`

### Examples

      ##create a basic object
      x <- 1
      class(x) <- "test"
      ## should be ok
      stCheckClass(x, "test", "x")
      ## this fails
      try( stCheckClass(x, "other", "x") )

[Package SpatioTemporal version 1.1.9.1 Index]