is_raster: Checks whether object is a SpatRaster and returns a matrix if...

View source: R/solartools.R

is_rasterR Documentation

Checks whether object is a SpatRaster 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 SpatRaster, returns a matrix containing all values of r, otherwise returns r

Examples

library(terra)
r <- is_raster(dtm100m)
class(dtm100m) # is a PackedSpatRaster
class(r) # is a matrix
plot(r) # not a SpatRaster
plot(rast(r)) # converts to SpatRaster

ilyamaclean/microclima documentation built on Sept. 5, 2024, 8:37 p.m.