#Create a window (owin) from a "shapefile". This "shp" correspond my study area library(maptools) S <- readShapePoly("area1.shp") SP <- as(S, "SpatialPolygons") W <- as(SP, "owin") summary(W) plot(W) #Spatial location of the "ficus" and "tienda" mydata <- read.table("Fig.tents.txt", header = TRUE) head(mydata) any(duplicated(mydata)) M <- unique(mydata) attach(M) north <- M$X west <- M$Y Z <- ppp(north, west,window=W,marks=tipo) summary(Z) plot(Z) #Kcross.inhom analysis attach(split(Z)) f<-bw.diggle(ficus) t<-bw.diggle(tienda) lambdaf<-density.ppp(ficus,f,at="points") lambdat<-density.ppp(tienda,t,at="points") K <- Kcross.inhom(Z, "ficus", "tienda", lambdaf, lambdat)