Converts a data.frame to a distance matrix.
df_to_matrix(data, lower = TRUE, upper = TRUE, diag = TRUE, na_to_zero = TRUE)a data.frame with the following three columns: from (the
first site), to (the second site) and distance (the value of the link
between two sites). The output of the function distance_along().
a logical value. If TRUE (default), keep values in the
lower triangle of the matrix. Otherwise they will be replaced by NA
(or 0).
a logical value. If TRUE (default), keep values in the
upper triangle of the matrix. Otherwise they will be replaced by NA
(or 0).
a logical value. If TRUE (default), keep values in the
diagonal of the matrix. Otherwise they will be replaced by NA
(or 0).
a logical value. If TRUE (default), missing edges are
coded as 0. Otherwise they will be coded as NA.
A matrix of dimensions m x n, where m is the number of sites
(from) and n is the number of sites (to).
# Add an example ----