#' Polygons ids
#'
#' Extraxt the ID of a SpatialPolygon or SpatialPolgyonsDataFrame. See \code{sp}
#'
#' @param obj a sp object
#' @return returns an vector with IDs
#' @author Hans Ole Ørka \email{hans.ole.orka@@gmail.com}
getPolygonID <- function(obj){
id <- sapply(slot(obj, "polygons"), function(x) slot(x, "ID"))
return(id)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.