R/pdist_rid_confl.R

Defines functions pdist_rid_confl

pdist_rid_confl <- function(to_xy, from_xy, snap_tolerance = NULL) {
	
	node_dist <- pdist(from_xy, to_xy)
	
	dist_matrix <- as.matrix(node_dist)
	colnames(dist_matrix) <- rownames(to_xy)
	rownames(dist_matrix) <- rownames(from_xy)
	
	## Returns a list == length(to_xy) with dist_matrix *names* containing
	## the rid value and the values representing the rid for other flow-connected edges connecting to the
	## same node. Does not capture flow-unconnected
	#1= rows, 2=columns
	confl.list <- apply(dist_matrix, 2, function(x) which(x <= snap_tolerance),
											simplify = FALSE)
	
	return(confl.list)
	
}

Try the SSNbler package in your browser

Any scripts or data that you put into this service are public.

SSNbler documentation built on Nov. 5, 2025, 7:38 p.m.