identify.map | R Documentation |
Identifies the map regions clicked by the user.
## S3 method for class 'map'
identify(x, n = 1, index = FALSE, ...)
x |
a map object containing named polygons. |
n |
the number of clicks to wait for. |
index |
If TRUE, returns the index of the polygon, rather than its name. |
... |
additional arguments passed to |
The current algorithm is somewhat crude — selects the region whose
centroid is closest to the click. A more sophisticated approach would
use map.where
.
a character vector of length n
, naming the selected regions.
Tom Minka
identify
, map.where
identify(map("state", fill = TRUE, col = 0))
if(require(mapproj))
identify(map("world", proj = "lagrange", fill = TRUE, col = 0, wrap=c(-180,180,-90)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.