[R] points inout a circle

Roger Bivand Roger.Bivand at nhh.no
Sat Feb 14 11:35:39 CET 2004

On Sat, 14 Feb 2004, Patrick Giraudoux wrote:

> Dear all,
> I would like to generate a circles of various diameters centered on a
> point in such a way each circle could be considered as a polygon and
> used further as such eg with the library splancs. The aim is to sweep
> each point on a grid or a "random" field of points and select other
> points wich are included in the circle (eg inout), for neighbourhood
> analysis.
> I wonder if such a function has been implemented in a package? (I did
> not find anything in the archives).

Making a circular polygon and then using inout() feels like overkill. If 
you need to stay in splancs, you could just wrap .C("pythag", ...) up in a 
function comparing the returned distance with the circle radius, having 
given it the locations of the two points.

However, I think dnearneigh() in spdep will do what you need, which
returns a list of integer vectors giving the point id numbers for
neighbours satisfying the distance criteria.


> Thanks for any hint.
> Best regards,
> Patrick Giraudoux
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Roger Bivand
Econonic Geography Section, Department of Economics, Norwegian School of 
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, 
Norway, voice: +47-55959355, fax: +47-55959393; Roger.Bivand at nhh.no

More information about the R-help mailing list