This function will return an object showing which faces are occupied by the input object.
Usage
occupied(gridObj, data, out = "logical", ...)
Arguments
- gridObj
(trigrid or hexagrid) An icoshedral grid.
- data
(matrix, data.frame, sf or Spatial) The queried data.
- out
(character) What shall be the output class? Can be either facelayer or logical (default.)
- ...
Arguments passed to the class specific methods
Value
The function returns a either a named logical vector or facelayer-class object.
Details
This is a wrapper function on the OccupiedFaces methods that are specific to grid class and input data.
Examples
# create a grid
g <- trigrid(8, sf=TRUE)
# create random points
randPoints <- rpsphere(100,output="polar")
# the faces occupied by these points
occ <- occupied(g, randPoints)
# plot using sf slot independently
plot(g@sf[occ,"geometry"])
points(randPoints, col="red", pch="+")