province.area <- function(province){
library(maptools)
library(gstat)
nation.edge <- 'bou2_4p.shp'
nc <- readShapePoly(nation.edge, proj4string = CRS("+proj=longlat +ellps=clrk66"))
tag <- grep(province,nc@data$NAME)
res <- NULL
for(i in 1:length(tag))
res <- rbind(res,nc@polygons[[tag[i]]]@Polygons[[1]]@coords)
library(splancs)
areapl(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.