Set, inspect, reset, save 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 temp directory but you can change it (for the current session) with rasterOptions(tmpdir="path")
.
To permanently set any of these options, you can add them to <your R installation>/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. All temporary raster files in that folder that are older than 24 hrs are deleted when the raster package is loaded.
Function tmpDir
returns the location of the temporary files
rasterOptions(format, overwrite, datatype, tmpdir, tmptime, progress,
timer, chunksize, maxmemory, todisk, setfileext, tolerance,
standardnames, depracatedwarnings, addheader, estimatemem, default=FALSE)
tmpDir(create=TRUE)
character. The default file format to use. See writeFormats
logical. The default value for overwriting existing files. If TRUE
, existing files will be overwritten
character. The default data type to use. See dataType
character. The default location for writing temporary files; See rasterTmpFile
number > 1. The number of hours after which a temporary file will be deleted. As files are deleted when loading the raster package, this option is only useful if you save this option so that it is loaded when starting a new session
character. Valid values are "text", "window" and "" (the default in most functions, no progress bar)
Logical. If TRUE
, the time it took to complete the function is printed
integer. Maximum number of cells to read/write in a single chunk while processing (chunk by chunk) disk based Raster* objects
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
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)
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
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
logical. Default is TRUE
. Should names
be standardized to be syntactically valid names (using make.names
)
logical. If TRUE
(the default) a warning is generated when a depracated (obsolete) function is used
character. If not equal to ''
(the default) an additional header file is written when a raster format file (grd/gri) is written. Supported formats are as in hdr
logical. If TRUE
, all options are set to their default values
logical. If TRUE
, the temporary files directory is created if it does not exist
logical. If TRUE
, the amount of RAM available is estimated, and the value of maxmemory is ignored
list of the current options (invisibly). If no arguments are provided the options are printed.
# NOT RUN {
rasterOptions()
rasterOptions(chunksize=2e+07)
# }
Run the code above in your browser using DataLab