Skip to contents

Shoelace formula to find the area of the polygon given by the vertices found: https://en.wikipedia.org/wiki/Shoelace_formula

Usage

shoelace(x, y)

Arguments

x

Numeric vector.

y

Numeric vector.

Value

Area of polygon enclosed by the given points (x, y).

Examples

shoelace(x = c(1, 1, 4, 4, 8), y = c(1, 4, 1, 4, 2))
#> [1] 9