1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
\author{Tom Minka}
\name{identify.map}
\alias{identify.map}
\title{
Identify regions on a map
}
\description{
Identifies the map regions clicked by the user.
}
\usage{
\method{identify}{map}(x, n = 1, index = FALSE, ...)
}
\arguments{
\item{x}{a map object containing named polygons.}
\item{n}{the number of clicks to wait for.}
\item{index}{If TRUE, returns the index of the polygon, rather than
its name.}
\item{...}{additional arguments passed to \code{\link{identify.default}}.}
}
\details{
The current algorithm is somewhat crude --- selects the region whose
centroid is closest to the click. A more sophisticated approach would
use \code{\link{map.where}}.
}
\value{
a character vector of length \code{n}, naming the selected regions.
}
\seealso{\code{\link{identify}}, \code{\link{map.where}}}
\examples{
identify(map("state", fill = TRUE, col = 0))
if(require(mapproj))
identify(map("world", proj = "lagrange", fill = TRUE, col = 0, wrap=c(-180,180,-90)))
}
\keyword{iplot}
|