adj_matrix: Binary adjacency matrix

View source: R/adj_matrix.R

adj_matrixR Documentation

Binary adjacency matrix

Description

Creates a binary matrix of adjacencies based on from-to graph relationships (joins)

Usage

adj_matrix(i, j = NULL)

Arguments

i

a vector or, if j = NULL a data.frame with two columns indicating from-to relationships (joins)

j

If specified, i must be a vector of same length and the i,j vectors must represent joins

Value

A binary matrix

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org> and Melanie A. Murphy <melanie.murphy@uwyo.edu>

Examples

 library(sf)
   data(ralu.site, package="GeNetIt")
   
 p <- as(ralu.site, "sf")
 g <- knn.graph(p[c(1,5,8,10,20,31),])
   plot(st_geometry(g))

 ( ind <- sf::st_drop_geometry(g[,1:2])[1:10,] ) 

 adj_matrix(ind)

 adj_matrix(g$i[1:10], g$j[1:10])


GeNetIt documentation built on July 9, 2023, 5:18 p.m.

Related to adj_matrix in GeNetIt...