create_node_labels {chessboard} | R Documentation |
Create unique node labels
Description
Creates unique node (sampling units) labels in directed (or undirected) spatial (or not) networks.
It's important to note that, even the package chessboard
is designed to
deal with spatial networks, it does not explicitly use spatial coordinates.
Every functions of the package will use the node labels.
To work, the package chessboard
requires that the sampling has two
dimensions:
one from bottom to top (called quadrats), and one from left to right
(called transects). If the sampling has been conducted along one single
dimension (transects or quadrats), this function will create a
fictitious label for the missing dimension.
In other words, the package chessboard
can work with sampling designs such
as regular grids (two dimensions), transects (one dimension), and quadrats
(one dimension).
In addition, the package can also deal with multiple locations. In that
case, users will need to use the argument location
.
The node labels will be of the form: 1-2
, where 1
is the identifier of
the transect (created by the function if missing), and 2
, the identifier
of the quadrat (created by the function if missing).
Usage
create_node_labels(data, location, transect, quadrat)
Arguments
data |
a |
location |
a |
transect |
a |
quadrat |
a |
Value
A data.frame
with at least the four following columns:
-
node
, the node label -
location
, the identifier of the location -
transect
, the identifier of the transect -
quadrat
, the identifier of the quadrat Other columns present in the original dataset will also be added.
Examples
library("chessboard")
# Two-dimensional sampling ----
sites_infos <- expand.grid("transect" = 1:3, "quadrat" = 1:5)
sites_infos
nodes <- create_node_labels(data = sites_infos,
transect = "transect",
quadrat = "quadrat")
nodes
gg_chessboard(nodes)
# One-dimensional sampling (only transects) ----
transects_only <- data.frame("transect" = 1:5)
nodes <- create_node_labels(transects_only,
transect = "transect")
nodes
gg_chessboard(nodes)
# One-dimensional sampling (only quadrats) ----
quadrats_only <- data.frame("quadrat" = 1:5)
nodes <- create_node_labels(quadrats_only,
quadrat = "quadrat")
nodes
gg_chessboard(nodes)