get_rastype: Check in the input is a 'Raster' object or raster file

Description Usage Arguments Value Note Author(s)

Description

Check if a R object or a filename correspond to a valid Raster object, to a raster file or none of the above. Useful to detect which kind of input is passed to a function and abort / do something in the case of "wrong" input.

Usage

1
get_rastype(in_rast, abort = TRUE)

Arguments

in_rast

name of an R object, or character giving the full path to a spatial file

abort

If TRUE, and in_rast is neither a raster object or filename, send an error message and abort, Default: TRUE

Value

character equal to "rastfile" (if in_rast is a raster file), rastobject (if in_rast is a R raster object) or NA if it is neither (unless abort == TRUE)

Note

Functions get_spatype, get_rastype and get_vectype come from package sprawl.

Author(s)

Lorenzo Busetto, phD (2017) lbusett@gmail.com


pobsteta/theia2r documentation built on May 25, 2019, 2:21 p.m.