View source: R/convert_to_integer.R
convert_to_integer | R Documentation |
Given a raster in float, double or any other format, this function will convert it to integer format. This can be important because it is often an unstated requirement of GRASS modules such as the one for zonal statistics.
convert_to_integer(x, out)
x |
A raster layer in the current GRASS mapset. |
out |
Name of the output raster. Avoid names with hyphens. |
Nothing. A raster with the name out
will be added to the current GRASS mapset.
# Will only run if GRASS is running
if(check_running()){
# Load data set
dem <- system.file("extdata", "dem.tif", package = "rdwplus")
# Set environment
set_envir(dem)
# Make an integer-valued version of 'dem.tif'
convert_to_integer("dem.tif", "int_dem.tif")
# Compare
plot_GRASS("dem.tif")
plot_GRASS("int_dem.tif")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.