Learn R Programming

raster (version 1.9-5)

Options: Global options for the raster package

Description

setOptions allows you to set, and inspect, a number of global options used by the raster package. Most of these options are used when writing files to disk. They can be ignored by specific functions if the corresponding argument is provided as an argument to these functions. The default location is returned by rasterTmpDir. It is the same as that of the R tempdir but you can change it (for the current session) with rasterOptions(tmpdir=. To permanentely set any of these options, you can add them to /etc/Rprofile.site. For example, to change the default directory used to save temporary files, add a line like this: options(rasterTmpDir='c:/temp/') to that file. Beware: all raster (*.grd and *.gri) files in that folder will be deleted every time the raster package is loaded. showOptions shows the current options. saveOptions attempts to save the current options (with the exception of the 'todisk' option) to the /etc/Rprofile.site file to make them persistent (they will be set when starting a new R session). clearOptions resets the options to their default values.

Usage

setOptions(format, overwrite, datatype, tmpdir, progress, timer, chunksize,
			maxmemory, todisk, setfileext, tolerance)
showOptions()
saveOptions()
clearOptions()

Arguments

format
Character. The default file format to use. See writeFormats
overwrite
Logical. The default value for overwriting existing files. If TRUE, existing files will be overwritten
datatype
Character. The default data type to use. See dataType
tmpdir
Character. The default location for writing temporary files; See rasterTmpFile
progress
Character. Valid values are "text", "window" and "" (the default in most functions, no progress bar)
timer
Logical. If TRUE, the time it took to complete the function is printed
chunksize
Integer. Maximum number of cells to read/write in a single chunk while processing (chunk by chunk) disk based Raster* objects
maxmemory
Integer. Maximum number of cells to read into memory. I.e., if a Raster* object has more than this number of cells, canProcessInMemory will return FALSE
todisk
Logical. For debugging only. Default is FALSE and should normally not be changed. If TRUE, results are always written to disk, even if no filename is supplied (a temporary filename is used)
setfileext
Logical. Default is TRUE. If TRUE, the file extension will be changed when writing (if known for the file type). E.g. GTiff files will be saved with the .tif extension
tolerance
Numeric. The tolerance used when comparing the origin and resolution of Raster* objects. Expressed as the fraction of a single cell. This should be a number between 0 and 0.5

Value

  • None. This function is used for the side-effect of setting global options.

See Also

options, rasterTmpFile