I am trying to perform a spatial join between point data and polygon data.
I have data that indicate the spatial coordinates of an event in my csv file A and have another file, shapefile B, that contains the boundaries of an area as polygons.
head(A) month longitude latitude lsoa_code crime_type 1 2014-09 -1.550626 53.59740 E01007359 Anti-social behaviour 2 2014-09 -1.550626 53.59740 E01007359 Public order 3 2014-09 -1.865236 53.93678 E01010646 Anti-social behaviour head(B@data) code name altname 0 E05004934 Longfield, New Barn and Southfleet <NA> 1 E05000448 Lewisham Central <NA> 2 E05003149 Hawcoat <NA>
I want to join the crime data A to my shapefile B to map the crime events that happen in my area A. Unfortunately I cannot perform an attribute join based
code as the code in A refers to different units than the code in B.
I've read a number of tutorials and posts but could not find an answer. I tried:
joined = over(A, B)
overlay, but did not accomplish what I wanted.
Is there a way to do this join directly or would an intermediate transformation from A to another format be needed?
Conceptually I want to select those points of A that fall into the
code areas of B (similar to "join based on spatial location in ArcGIS").
Did someone have this issue and solved it?