r - Choropleth or Thematic map creation from number of points within Shapefile polygon -


i have geocoded data points (.csv) , shapefile (tigerline) read r , maps overlaying points (locations) on polygons (counties) under same projection using plot() , add=.

i trying find way map number of points found in each polygon (county). assume choropleth or sort of thematic map. associating shapefile , points throwing me loop.

and if can't tell, both r , spatial analysis newbie

i have gotten far:

count1<-table(epoints.spdf$county.name)

count1

count2<-as.data.frame(count1)

count2

county$count<-count2

merge(count2$freq, county$count, = c('var1', 'county.name'))

error in fix.by(by.x, x) : 'by' must specify uniquely valid columns

           var1 freq   

1 amelia 7
2 caroline 33
3 charles city 1
4 chesterfield 209
5 colonial heights 26
6 dinwiddie 23
7 goochland 15
8 hanover 84
9 henrico 241
10 hopewell 24
11 king william 12
12 new kent 23
13 petersburg 38
14 powhatan 20
15 prince george 18
16 richmond 194
17 sussex 16

solved:
count1<-table(epoints.spdf$county.name)
count1
count2<-as.data.frame(count1)
count2
merge(count2, county@data, by.x = 'var1', by.y= 'name')
names(county)
data.frame(county)


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -