edges_weights_vector {chessboard} | R Documentation |
Create an edges weights vector
Description
Creates an edges weights vector that can be used in aem()
of the package
adespatial
. Resulting edges weights equal to 0 will be replaced by
4 x max(w)
, where max(w)
is the maximal weight in the matrix.
Usage
edges_weights_vector(x, y)
Arguments
x |
a |
y |
a |
Value
An edges weights vector
.
Examples
# Import Adour sites ----
path_to_file <- system.file("extdata", "adour_survey_sampling.csv",
package = "chessboard")
adour_sites <- read.csv(path_to_file)
# Select the 15 first sites ----
adour_sites <- adour_sites[1:15, ]
# Create node labels ----
adour_sites <- create_node_labels(adour_sites,
location = "location",
transect = "transect",
quadrat = "quadrat")
# Convert sites to sf object (POINTS) ----
adour_sites_sf <- sf::st_as_sf(adour_sites,
coords = c("longitude", "latitude"),
crs = "epsg:2154")
# Create edges based on the pawn move (directed network) ----
adour_edges <- create_edge_list(adour_sites, method = "pawn",
directed = TRUE)
# Create nodes-by-edges matrix ----
adour_matrix <- nodes_by_edges_matrix(adour_edges)
# Compute Euclidean distances between pairs of sites ----
adour_dists <- distance_euclidean(adour_sites_sf)
# Create Edges weights vector ----
edges_weights_vector(adour_matrix, adour_dists)
[Package chessboard version 0.1 Index]