geo_random: Create a 'geom' randomly

View source: R/geo_random.R

geo_randomR Documentation

Create a geom randomly

Description

This function creates a random geometry

Usage

geo_random(type = "point", window = NULL, vertices = NULL)

Arguments

type

character(1)
Either one of the three main feature types "point", "line" or "polygon", "random", or more specifically one of their subtypes, e.g. "hexagon" (subtypes currently not yet supported).

window

data.frame(2)
in case the reference window deviates from the bounding box of crds, specify here the minimum and maximum values in columns x and y.

vertices

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.

Value

A geom.

See Also

Other geometry shapes: geo_line(), geo_point(), geo_polygon()

Examples

# create a random polygon with five vertices
set.seed(1)
someGeom <- geo_random(type = "polygon", vertices = 5)
geo_vis(geom = someGeom, linecol = "#FFB000")

# in case template is given, this serves as source for the window extent
geo_vis(geom = geo_random(), linecol = "#B24223", pointsymbol = 22, new = FALSE)

EhrmannS/geometr documentation built on Jan. 31, 2024, 9:13 a.m.