[R] calculate area of outer polygon

Tord Snäll Tord.Snall at nvb.slu.se
Mon Oct 23 10:31:02 CEST 2006


Dear all,
Does anyone know of a function that calculates the area of the outer 
polygon constructed from a data frame with co-ordinates? For example,
library(splancs)
test = rbind(c(0,0), c(10,0),c(10,10),c(0,20))
plot(test)
areapl(test)
[1] 150
This is OK, but I want the same area to be returned (150) when adding 
yet another co-ordinate in the middle of the polygon:
test = rbind(c(0,0), c(10,0),c(10,10),c(0,20),c(5,5))
plot(test)
areapl(test)
[1] 100

I have also tested area.owin() in library(spatstat) but the co-ordinates 
of the outer polygon is one of the arguments.


Thanks!

Tord

-- 

NOTE, new e-mail and contact information:

Tord Snäll
Department of Conservation Biology
Swedish University of Agricultural Sciences (SLU)
P.O. 7002, SE-750 07 Uppsala, Sweden
Office/Mobile/Fax
+46-18-672740/+46-730-891356/+46-18-673537
E-mail: tord.snall at nvb.slu.se
www.nvb.slu.se/staff_tordsnall



More information about the R-help mailing list