if_raster: Flexible conversion to raster object

View source: R/solartools.R

if_rasterR Documentation

Flexible conversion to raster object

Description

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

Usage

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

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/microclima documentation built on Oct. 31, 2023, 11:41 p.m.