poly.counts: Number of Points in Each Polygon

Description Usage Arguments Value Author(s) Examples

Description

Given a set of points, and a set of polygons, computes the number of points in each polygon.

Usage

1
poly.counts(pts, polys)

Arguments

pts

A SpatialPoints or SpatialPointsDataFrame object.

polys

A SpatialPolygons or SpatialPolygonsDataFrame object.

Value

A list of integers of the same length as the number of polygons in polys, giving the number of points from pts.

Author(s)

Chris Brunsdon

Examples

1
2
3
4
5
6
# Data for New Haven to use in example
data(newhaven)
# How many breaches of peace in each census block?
n.breach = poly.counts(breach,blocks)
# Compute densities and map them
choropleth(blocks,n.breach/poly.areas(blocks))

Example output

Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: RColorBrewer
Loading required package: MASS
Loading required package: rgeos
rgeos version: 0.3-23, (SVN revision 546)
 GEOS runtime version: 3.4.2-CAPI-1.8.2 r3921 
 Linking to sp version: 1.2-3 
 Polygon checking: TRUE 

GISTools documentation built on May 6, 2019, 1:09 a.m.