Prepend (or postpend) a filename with a prefix (or suffix). If the directory name of the file cannot be ascertained from its path, it is assumed to be in the current working directory.

.prefix(f, prefix = "")

.suffix(f, suffix = "")

Arguments

f A character string giving the name/path of a file. A character string to prepend to the filename. A character string to postpend to the filename.

Examples

# file's full path is specified (i.e., dirname is known)
myFile <- file.path("~/data", "file.tif")