Skip to contents

Spatstat point pattern objects consist of points and an observation windows. This function uses a SpatialPoints object and a SpatialPolygon object to generate the points and the window. Lastly, the ppp() function is called to create the ppp object.

Usage

spatial.to.ppp(points, samplers)

Arguments

points

A SpatialPoints[DataFrame] object describing the point pattern.

samplers

A SpatialPolygons[DataFrame] object describing the observation window.

Value

A spatstat spatstat

ppp object

Examples

# \donttest{
if (require("spatstat.geom") &&
  bru_safe_sp() &&
  require("sp")) {
  # Load Gorilla data

  data("gorillas", package = "inlabru")

  # Use nest locations and survey boundary to create a spatstat ppp object

  gp <- spatial.to.ppp(gorillas$nests, gorillas$boundary)
  class(gp)

  # Plot it

  plot(gp)
}
#> Loading required package: spatstat.geom
#> Loading required package: spatstat.data
#> 
#> Attaching package: ‘spatstat.data’
#> The following object is masked _by_ ‘.GlobalEnv’:
#> 
#>     gorillas
#> The following object is masked from ‘package:inlabru’:
#> 
#>     gorillas
#> spatstat.geom 3.2-9
#> 
#> Attaching package: ‘spatstat.geom’
#> The following objects are masked from ‘package:raster’:
#> 
#>     area, rotate, shift
#> Warning: data contain duplicated points

# }