Skip to contents

This function will return neighbouring faces of the input faces.

Usage

vicinity(gridObj, faces, ...)

# S4 method for trigrid,character
vicinity(
  gridObj,
  faces,
  order = 1,
  output = "vector",
  self = TRUE,
  namedorder = FALSE,
  ...
)

Arguments

gridObj

(trigrid or hexagrid) Icosahedral grid object.

faces

(character) A vector specifying names of faces.

...

Arguments passed to the ego function.

order

(numeric) Passed to the ego function, an integer value specifying the size of the neighborhood around a face.

output

(character) The type of the output. The default "vector" will give back the names of the faces that adjacent to the faces specified, including themselves. "list" will return a list.

self

(logical) Flag indicating whether the input faces should be in the output. For the "list" output option, the input face names will be omitted only from those character vectors that contain face names that are related to the face in question.

namedorder

(logical) Should the orders of the neighbouring cells be reported (TRUE) or just the names of the cells (default, FALSE).

Value

A character vector or a list of character vectors.

Examples

g <- trigrid(3)
ne <- vicinity(g, c("F4", "F10"))
ne
#> [1] "F10" "F11" "F18" "F28" "F3"  "F4"  "F5"  "F9"