[R-sig-Geo] Distance rule that filtering a set of points in "ppp" class by minimum or maximum distance

ASANTOS @|ex@ndre@@nto@br @end|ng |rom y@hoo@com@br
Fri Aug 28 03:17:58 CEST 2020


Dear R-Sig_Geo Members,

I'd like to find a more simple way to filtering a set of points in a 
"ppp" object by minimum or maximum distance.

In my example using a ants ("ppp" object) in spatstat package:

#Packages
library(spatstat)
library(sp)

#Point process example
data(ants)
str(ants)
#- attr(*, "class")= chr "ppp"

#Computes the matrix of distances between all pairs of ants nests and 
selection of more than 20 m distance neighborhood
ants.df<-as.data.frame(ants)
coordinates(ants.df) <- ~x+y
ants.dmat <- spDists(ants.df) #Calculate a distance matrix using spDists
min.dist <- 20 #distance range
ants.dmat[ants.dmat <= min.dist] <- NA # Na for less than 20 meters

Here yet I need to start a relative long code for identified columns 
with NA in ants.dmat object, create a new data frame and than create a 
new ppp object based in the coordinates and marks etc...

Is there any more easy way for create a new "ppp" object just only 
specified a distance rule that filtering a set of points in a original 
"ppp" object by minimum or maximum distance?

Thanks in advanced,

Alexandre

-- 
Alexandre dos Santos
Geotechnologies and Spatial Statistics applied to Forest Entomology
Instituto Federal de Mato Grosso (IFMT) - Campus Caceres
Caixa Postal 244 (PO Box)
Avenida dos Ramires, s/n - Vila Real
Caceres - MT - CEP 78201-380 (ZIP code)
Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674
Lattes CV: http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722
ResearchGate: www.researchgate.net/profile/Alexandre_Santos10
Publons: https://publons.com/researcher/3085587/alexandre-dos-santos/
--


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list