View source: R/retrieve_vector.R
| retrieve_vector | R Documentation | 
This function writes a GRASS mapset vector layer (like a shapefile) to file.
retrieve_vector(layer, out_layer, overwrite = FALSE, ...)
| layer | The name of the vector layer in the GRASS mapset that is to be written out. | 
| out_layer | The name of the shapefile to be created (with .shp file extension). | 
| overwrite | A logical indicating whether the output from this function should be allowed to overwrite any existing files. Defaults to  | 
| ... | Additional arguments to  | 
Nothing.
# Will only run if GRASS is running
if(check_running()){
# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")
stream_shp <- system.file("extdata", "streams.shp", package = "rdwplus")
# Set environment parameters and import data to GRASS
set_envir(dem)
vector_to_mapset(vectors = stream_shp)
# Retrieve raster 
out_name <- paste0(tempdir(), "/", "retrieved_streams.shp")
retrieve_vector("streams", out_layer = out_name, overwrite = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.