[R] alignments in random points

Denis Francisci denis.francisci at gmail.com
Tue Nov 10 17:26:08 CET 2015


Dear forum,
I have a number of random point in a polygon. I would like to find those
points lying on the same lines.
Is there an R function to find alignments in points (something like this:
https://en.wikipedia.org/wiki/Alignments_of_random_points)?
And is it possible to do the same thing but changing the width of lines?

If it could be useful, I attached an example of R code that I'm using.

Thank's in advance,

DF


CODE:

library(sp)
poly<-matrix(c(16,17,25,22,16,58,55,55,61,58),ncol=2,nrow=5)

> poly
     [,1] [,2]
[1,]   16   58
[2,]   17   55
[3,]   25   55
[4,]   22   61
[5,]   16   58

p=Polygon(poly)
ps=Polygons(list(p),1)
sps=SpatialPolygons(list(ps))

p.rd=spsample(sps,n=150,"random")
plot(sps)
points(p.rd,pch=16, col='blue',cex=0.3)

	[[alternative HTML version deleted]]



More information about the R-help mailing list