if_raster: Flexible conversion to raster object

Description Usage Arguments Value Examples

Description

if_raster is used to permit flexibility in the use of rasters, matrices or arrays in many functions.

Usage

1
if_raster(x, r)

Arguments

x

an R object

r

an R object

Value

if r is a raster, x is converted to a raster with the same attributes as r, otherwise returns x

Examples

1
2
3
4
5
r <- is_raster(dtm100m)
r1 <- if_raster(r, dtm100m)
r2 <- if_raster(r, r)
class(r1) # is a RasterLayer
class(r2) # is a matrix

ilyamaclean/ecohydrotools documentation built on June 10, 2019, 5:45 a.m.