[R-sig-Geo] R: individuals distribution points in paired polygons

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sun Sep 7 11:57:58 CEST 2014


On Sun, Sep 7, 2014 at 9:31 AM, Alice C. Hughes
<dr_achughes at hotmail.co.uk> wrote:
> I have distribution points (in excel or spatial point form) for a set ofindividuals and a file of polygons-with matching IDs: so each individual hasa set of points and a polygon with the same IDs:

 Sounds like you have a dataset of  Person_ID, Polygon_ID pairs - two columns...

>but there are 100's to1000's of individuals.

 and 100 or a 1000 rows for each individual times however many
observations for each individual. Not exactly Big Data...

> What I would like to do is to go through and for each individual find thetotal number of points and the number which fall within the appropriatepolygon

Assuming your data are in a dataframe called "distribution", then
that's trivially:

 table(distribution$Person_ID)

and

 table(distribution$Person_ID, distribution$PolygonID)

> then have the output in spreadsheet form with a column for ID;Total number of points; points in polygon. Each individual has a polygon with the same name, but every code I've seenso far can't differentiate, or scroll through multiple point files withunique IDs

 Now here's where we get lost. Multiple "point files" wth unique IDs?
What are "point files"? Where did they come from? You need to clearly
state the structure of your data, what you've read into R, and give
some summaries of it.

Barry



More information about the R-sig-Geo mailing list