Description Usage Arguments Value Note Source References See Also Examples
View source: R/create_random_raster.R
create_random_raster
creates a set of different rasters with a specified
number of rows and columns. For a set of classes, randomly 1
selected for each class and filled with the respective colour value. 20
cells will be enlarged by the next pixel to the right, to the top and to the top right.
Each created raster will be exported as jpg file with a fixed resolution of
6000 times 6000 pixels. The funciton is used in order to create random rasters that serve
as templates in order to collect test and training samples.
1 2 3 | create_random_raster(n.col.raster = 200, n.row.raster = 200,
colours.cells = c("lightgrey", "green", "red"), seed = c(1:4),
directory.result)
|
n.col.raster |
A numeric value representing the number of columns of the raster to create. |
n.row.raster |
A numeric value representing the number of rows of the raster to create. |
colours.cells |
A character vector with colours to use for each class. |
seed |
A numeric vector with integers. For each element of |
directory.result |
A character string representing the directory where the results will be stored. |
The function returns nothing, but stores a jpg file of each created
raster into directory.result
. Created rasters have a resolution of
6000 times 6000 pixels and are named as raster_position_x_y where x is the
respective element of seed
and y the number of elements in
colours.cells
, i.e. the number of different classes.
Since the function pos2coord
is part of the package sinkr
,
but not implemented in its structure, the R script has to be sourced prior
using create_random_raster
. The function pos2coord
can be retrieved
from the github repository of the author of sinkr
:
https://github.com/marchtaylor/sinkr/blob/master/R/pos2coord.R.
The function relies on the R packages raster
(\insertCiteHijmans.2017TraceIdentification) and sinkr
(\insertCiteTaylor.2017TraceIdentification).
.
1 | #
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.