Hi, I'm pretty sure that what you ask is likely not too hard to do. On the other hand, I think you will do well to consider the following...
1. Join the mailing list; the folks there will know better what you are trying to do - see https://stat.ethz.ch/mailman/listinfo/r-sig-geo <https://stat.ethz.ch/mailman/listinfo/r-sig-geo> 2. Switch from the sf package to the sf package if you can - see https://cran.r-project.org/web/packages/sf/ 3. Come up to speed with geospatial data handling in R starting here https://geocompr.robinlovelace.net/index.html Cheers, Ben > On Oct 2, 2018, at 10:33 AM, Ivy Pieters <icwpiet...@gmail.com> wrote: > > 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, > > Ivy > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org Ecological Forecasting: https://eco.bigelow.org/ [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.