This is mostly just a wrapper around filename from the raster package, except that instead of returning an empty string for a RasterStack object, it will return a vector of length >1 for RasterStack.

Filenames(obj, allowMultiple = TRUE)

# S4 method for ANY
Filenames(obj, allowMultiple = TRUE)

# S4 method for Raster
Filenames(obj, allowMultiple = TRUE)

# S4 method for RasterStack
Filenames(obj, allowMultiple = TRUE)

# S4 method for environment
Filenames(obj, allowMultiple = TRUE)

# S4 method for list
Filenames(obj, allowMultiple = TRUE)

Arguments

obj

A Raster* object (i.e., RasterLayer, RasterStack, RasterBrick)

allowMultiple

Logical. If TRUE, the default, then all relevant filenames will be returned, i.e., in cases such as .grd where multiple files are required. If FALSE, then only the first file will be returned, e.g., filename.grd, in the case of default Raster format in R.