[R] point.in.polygon help
macqueen1 at llnl.gov
Thu May 23 21:08:09 CEST 2013
In that case I'd definitely look more at the over() function than that
ugly bit I suggested before.
Get your fish info into a SpatialPointsDataFrame
Since your polygons are in a SpatialPolygonsDataFrame, I would expect the
data frame part has one row per basin, and it contains the basin names or
other unique identifier. Loop through the basin names, subsetting the
SpatialPolygonsDataFrame for each each basin, then use the over() function
the with the fish SpatialPointsDataFrame to tell you which fish are in the
That's an outline; there are obviously lots of details that would be
This should work even if, for example, a single basin consists of more
than one polygon (presumably non-overlapping).
There may be a more efficient way, but I don't know it off the top of my
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
On 5/23/13 6:03 AM, "karengrace84" <kgfisher at alumni.unc.edu> wrote:
>I am looking at fish tagging data. I have gps coordinates of where each
>was tagged and released, and I have a map of 10 coastal basins of the
>of Louisiana. I am trying to determine which basin each fish was tagged
>View this message in context:
>Sent from the R help mailing list archive at Nabble.com.
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help