is.inside | R Documentation |
is.inside
checks whether a point or a set of points is inside a polygon, e.g., borders of a country.
is.inside(x, y, verbose = FALSE, plot = FALSE)
x |
an esd-object or a list/data.frame with the elements |
y |
A polygon in the shape of a list/data.frame with the elements
|
verbose |
|
plot |
|
N |
Number of tests with random coordinates |
a boolean; TRUE
if the point(s) x
is/are inside the polygon y
.
## Not run:
library(readINAMdata)
data("Moz")
osmoz <- !is.inside(data.frame(x=lons,y=lats),Moz)
plot(lons,lats)
points(lons[osmoz],lats[osmoz],pch=19,col='red')
points(lons[!osmoz],lats[!osmoz],pch=19,col='green')
points(lons[is.na(osmoz)],lats[is.na(osmoz)],pch=19,col='black')
lines(Moz,type='b')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.