
Last chance! 50% off unlimited learning
Sale ends in
geom
randomlyThis function creates a random geometry
gs_random(type = "point", window = NULL, vertices = NULL, ...)
[character(1)
] Either one of the three main feature
types "point"
, "line"
or "polygon"
, or more
specifically one of their subtypes, e.g. "hexagon"
.
[data.frame(1)
] in case the reference window deviates
from the bounding box [0, 1] (minimum and maximum values), specify this
here.
[integerish(1)
] the number of vertices the geometry
should have; only meaningful if type
does not indicate the number of
vertices already. If left at NULL
the minimum number of vertices for
the geom
type, i.e. 1 for point
, 2 for line
and 3 for
polygon
.
[various] additional arguments.
Other geometry shapes:
gs_line()
,
gs_point()
,
gs_polygon()
# NOT RUN {
input <- matrix(nrow = 100, ncol = 100, data = 0)
# create a random polygon with five vertices
set.seed(1)
someGeom <- gs_random(type = "polygon", vertices = 5)
visualise(geom = someGeom)
# in case template is given, this serves as source for the window extent
library(magrittr)
gs_random(template = input) %>%
visualise(geom = ., new = FALSE, linecol = "red")
# }
Run the code above in your browser using DataLab