| node_index | R Documentation |
Translate a vector of original cell identifiers into the 1-based node indices
of a tulpa_adjacency graph, by key (not by row order). Use it to add the
node-index column the model's spatial grouping bar needs to the observation
data, which typically has many rows per cell and a different row order than
the graph.
node_index(graph, ids)
graph |
A |
ids |
A vector of cell identifiers to look up (matched against
|
An integer vector the same length as ids, giving each one's node
index in graph (NA for identifiers absent from the graph).
adjacency().
grid <- expand.grid(x = 1:3, y = 1:3)
grid$cell <- paste0("c", seq_len(nrow(grid)))
g <- adjacency(grid, id = "cell")
obs <- data.frame(cell = c("c5", "c1", "c9"))
obs$cell_idx <- node_index(g, obs$cell)
obs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.