[R] Sp-package overlay

Ivy Pieters icwpieter@ @ending from gm@il@com
Tue Oct 2 16:33:40 CEST 2018

Hey there, 

For my internship I have to work with R. I am working with R for the first
time and I don't know much. 
Somehow I don't manage to find the answer to my question in google. I think
I don't search with the right words, or maybe I just don't understand
enough. Anyways, I hope someone here can help me out. 

I have 2 datasets: 

a SpatialPolygonDataFrame, this dataset is called "field" (these are
different fields of arable land) 
and a SpatialPointsDataFrame, this dataset is called "odk" (these are
different soil samples taken in each field) 

The field data set consists of 8 polygons and they have a slot with coords 

The odk data set consists of 537 features (soil samples), these features
belong to the polygons but they are all mixed. This dataset also has a slot
with coords 

They are both projected in the same coordinate system. 

Now I would like to create a new dataset with a table with the features of
odk that belong to polygon 1 and a separate table for the features that
belong to polygon 2 etc. The best is if they also get into the
spatialpointsdataframe format. 

I really don't know how to do this. I hope someone here can help me out. I
hope that I gave enough information for anyone to help me else let me know
if I have to tell something more about my datasets. 

Thank you already a lot in advance, 

Hope to hear from anyone soon, 

Kind regards, 


More information about the R-help mailing list