Return a area from polygon xy coordinates

area(xy)

Arguments

xy

a atrix or data frame of xy coordinates

Value

a vector of polygon area

Examples

xy<-data.frame(x=c(0,1,2,1),y=c(1,2,1,0))
plot(xy,type="b") ; polygon(xy)

area(xy)
#> [1] 2