Learn R Programming

assertive.types (version 0.0-3)

assert_is_raster: Is the input a raster?

Description

Checks to see if the input is a raster.

Usage

assert_is_raster(x, severity = getOption("assertive.severity", "stop"))
is_raster(x, .xname = get_name_in_parent(x))

Arguments

x
Input to check.
severity
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".
.xname
Not intended to be used directly.

Value

is_raster wraps is.raster, providing more information on failure. is_a_raster returns TRUE if the input is raster and scalar. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

See Also

is.raster.

Examples

Run this code
m <- matrix(hcl(0, 80, seq(50, 80, 10)), nrow=4, ncol=5)
assert_is_raster(as.raster(m))
## Not run: 
# #These examples should fail.
# assert_is_raster(m)
# ## End(Not run)

Run the code above in your browser using DataLab