A quick-and-dirty all spatstat solution:
library(spatstat)
eps <- 10
x <- pixellate(ants, eps = eps)
x[x>0] <- 1
y <- 0*x
s <- eps*c(-1,0,1)
for(i in s){
for(j in s){
y <- y + shift.im(x, vec = c(i,j))
}
}
z <- y
z[z>0] <- 1
plot(solist(x, y, z), main = "")
/Ege
On Tue, 2020-11-10 at
Thanks Ben,
Little things do matter, I changed cells<- xyFromCell(antscount, ants1)
by cells <- unique(cellFromXY(antscount, geo.form)) and works!!
Final solution:
#Packages
library(spatstat)
library(raster)
#Selection of ants data set
data(ants)
geo.form<-cbind(x=ants$x,y=ants$y)
Hi,
Thanks for updating the example - it is much easier. I'm still not
sure of exactly what you are after, but my day is young and there is
still coffee to be had.
One thing I suggest is that you modify your computation of cells. As
you have it, you are computing a matrix of x and y locations.