Description Usage Arguments Examples

Get all indices in neighbourhood

1 2 | ```
neighbour_idx(mat, idx, mask = NULL, diagonal = TRUE,
include.idx = FALSE)
``` |

`mat` |
matrix or data.frame |

`idx` |
two-element vector |

`mask` |
logical matrix; optional |

`diagonal` |
include diagonal neighbours |

`include.idx` |
include current index |

1 2 3 4 5 6 7 8 9 10 | ```
mat <- matrix(0, 3, 3)
neighbour_idx(mat, c(1, 2))
neighbour_idx(mat, c(1, 2), diagonal = FALSE)
neighbour_idx(mat, c(1, 2), diagonal = FALSE, include.idx = TRUE)
# With mask
mat <- matrix(0, 3, 4)
mask <- m(FALSE, FALSE, TRUE, TRUE |
FALSE, FALSE, FALSE, FALSE |
TRUE, TRUE, FALSE, TRUE)
neighbour_idx(mat, c(1, 2), mask = mask)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.