mow {fasterRaster} | R Documentation |
Remove rasters and vectors from the GRASS cache
Description
fasterRaster functions attempt to delete rasters and vectors in the GRASS cache, but not all intermediate files can be removed. This function can be used to clear the cache of extraneous rasters and vectors.
Calling this function inside another function's environment and defining x
as "*"
can be very dangerous, as it will detect objects outside of that environment, and thus delete any rasters/vectors outside that environment. Here is a guide:
To delete files associated with a single
GRaster
orGVector
, usemow(GRaster_to_unlink)
ormow(GVector_to_unlink)
. To remove all rasters, all vectors, or all rasters and vectors in the GRASS cache that are not linked to aGRaster
orGVector
, usemow("*")
. To remove all rasters or all vectors in the GRASS cache, usemow("*", type = "rasters")
ormow("*", type = "vectors")
. To remove all rasters or all vectors in the GRASS cache except for certain ones, usemow("*", unlinked = FALSE, keep = list(GRaster_to_keep, GVector_to_keep))
. You can combine this with thekeep
argument to retain specific rasters or vectors. For example, you can usemow("*", unlinked = FALSE, type = "rasters", keep = list(GRaster_to_keep))
.
Usage
mow(
x = "unlinked",
pos = NULL,
type = NULL,
keep = NULL,
verbose = TRUE,
ask = TRUE
)
Arguments
x |
Any of:
|
pos |
Either |
type |
Either |
keep |
Either |
verbose |
Logical: If |
ask |
Logical: If |
Value
Invisibly returns a named vector with the number of rasters and vectors deleted.
See Also
Examples
if (grassStarted()) {
# Setup
madElev <- fastData("madElev")
elev <- fast(madElev)
mow(elev, ask = TRUE) # delete GRASS raster attached to `elev`
}