mow | R Documentation |
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
or GVector
, use mow(GRaster_to_unlink)
or mow(GVector_to_unlink)
.
To remove all rasters, all vectors, or all rasters and vectors in the GRASS cache that are not linked to a GRaster
or GVector
, use mow("*")
.
To remove all rasters or all vectors in the GRASS cache, use mow("*", type = "rasters")
or mow("*", type = "vectors")
.
To remove all rasters or all vectors in the GRASS cache except for certain ones, use mow("*", unlinked = FALSE, keep = list(GRaster_to_keep, GVector_to_keep))
. You can combine this with the keep
argument to retain specific rasters or vectors. For example, you can use mow("*", unlinked = FALSE, type = "rasters", keep = list(GRaster_to_keep))
.
mow(
x = "unlinked",
pos = NULL,
type = NULL,
keep = NULL,
verbose = TRUE,
ask = TRUE
)
x |
Any of:
|
pos |
Either |
type |
Either |
keep |
Either |
verbose |
Logical: If |
ask |
Logical: If |
Invisibly returns a named vector with the number of rasters and vectors deleted.
terra::tmpFiles()
if (grassStarted()) {
# Setup
madElev <- fastData("madElev")
elev <- fast(madElev)
mow(elev, ask = TRUE) # delete GRASS raster attached to `elev`
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.