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, returnList = FALSE)
# S4 method for class 'ANY'
Filenames(obj, allowMultiple = TRUE, returnList = FALSE)
# S4 method for class 'environment'
Filenames(obj, allowMultiple = TRUE, returnList = FALSE)
# S4 method for class 'list'
Filenames(obj, allowMultiple = TRUE, returnList = FALSE)
# S4 method for class 'data.table'
Filenames(obj, allowMultiple = TRUE, returnList = FALSE)
# S4 method for class 'Path'
Filenames(obj, allowMultiple = TRUE, returnList = FALSE)
A Raster*
object (i.e., RasterLayer
, RasterStack
, RasterBrick
)
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.
Default FALSE
. If FALSE
, then return format will be a
character vector. When TRUE
, list or environment objects will return a list
of character strings or vectors. When returned as a character vector, then
the names of objects with >1 filename associated with them will be given a numeric
suffix, which means the name in the returned vector does not match the object in
the list or environment. When returned as a list, their names are preserved.
A character vector of filenames that are part of the objects passed to obj
.
This returns NULL
is the object is not file-backed or does not have a method
to recover the file-backed filename.
New methods can be made for this generic.