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)

# S4 method for ANY
Filenames(obj)

# S4 method for Raster
Filenames(obj)

# S4 method for RasterStack
Filenames(obj)

# S4 method for environment
Filenames(obj)

# S4 method for list
Filenames(obj)

Arguments

obj

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