is_raster: Checks whether object is a raster and returns a matrix if yes

View source: R/solartools.R

is_rasterR Documentation

Checks whether object is a raster and returns a matrix if yes

Description

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

Usage

is_raster(r)

Arguments

r

an R object

Value

if r is a raster, returns a matrix containing all values of r, otherwise returns r

Examples

library(raster)
r <- is_raster(dtm100m)
class(dtm100m) # is a RasterLayer
class(r) # is a matrix
plot(r) # not a raster
plot(raster(r)) # converts to raster

ilyamaclean/microclima documentation built on Oct. 31, 2023, 11:41 p.m.