Learn R Programming

reproducible (version 1.2.11)

updateFilenameSlots: A helper function to change the filename slot of Raster* objects

Description

This is intended for internal use, though it is exported because other packages use this. This function exists because when copying file-backed rasters, the usual mechanism of writeRaster can be very slow. This function allows for a user to optionally create a hard link to the old file, give it a new name, then update the filename slot(s) in the Raster* class object. This can be 100s of times faster for large rasters.

Usage

updateFilenameSlots(obj, curFilenames, newFilenames, isStack = NULL)

# S3 method for default updateFilenameSlots(obj, ...)

# S3 method for list updateFilenameSlots(obj, ...)

# S3 method for environment updateFilenameSlots(obj, ...)

# S3 method for Raster updateFilenameSlots(obj, curFilenames, newFilenames, isStack = NULL)

Arguments

obj

An object. This function only has useful methods for Raster*, with all other classes being simply a pass-through

curFilenames

An optional character vector of filenames currently existing and that are pointed to in the obj. If omitted, will take from the obj using Filenames(obj)

newFilenames

An optional character vector of filenames to use instead of the curFilenames. This can also be a single directory, in which case the renaming will be given: file.path(newFilenames, basename(Filenames(obj, allowMultiple = FALSE)))