[R-sig-Geo] Minimum Convex Polygon
chima Nwaogu
nwaoguchima at yahoo.co.uk
Tue Feb 19 19:37:47 CET 2013
Hi all,
I got these set of codes to compute mcp which worked well in drawing the polygons but I don't have any idea about how the get the areas of the various polygons calculated for each study site. Here is what I did using version 2.15.2; data for location 1 attached with mail.
library(ggplot2)
library(plyr)
##Location 1
mcpyankari<-read.csv("mcpyankari.csv")
head(mcpyankari)
find_hully <- function(mcpyankari) mcpyankari[chull(mcpyankari$long, mcpyankari$lat), ]
hullsy <- ddply(mcpyankari, "mcpyankari$Individual", find_hully)
plot <- ggplot(data = hullsy, aes(x = long, y = lat, colour=Individual, fill = Individual)) +
geom_point() + geom_polygon(data = hullsy, alpha= 0.5) + labs(x = "Longitude", y = "Latitude")
plot
##Location 2
mcpkainji<-read.csv("mcpkainji.csv")
head(mcpkainji)
find_hullk <- function(mcpkainji) mcpkainji[chull(mcpkainji$long, mcpkainji$lat), ]
hullsk <- ddply(mcpkainji, "mcpkainji$Individual", find_hullk)
plot <- ggplot(data = hullsk, aes(x = long, y = lat, colour=Individual, fill = Individual)) +
geom_point() + geom_polygon(data = hullsk, alpha = 0.5) + labs(x = "Longitude", y = "Latitude")
plot
Thanks
Chima
WebRep
Overall rating
This site has no rating
(not enough votes)
WebRep
Overall rating
This site has no rating
(not enough votes)
WebRep
Overall rating
This site has no rating
(not enough votes)
WebRep
Overall rating
This site has no rating
(not enough votes)
WebRep
Overall rating
This site has no rating
(not enough votes)
WebRep
Overall rating
This site has no rating
(not enough votes)
WebRep
Overall rating
This site has no rating
(not enough votes)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130219/c6a6c3bc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcpyankari.csv
Type: application/vnd.ms-excel
Size: 2744 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130219/c6a6c3bc/attachment.xlb>
More information about the R-sig-Geo
mailing list