library(sf, quietly = TRUE)
library(tidygraph, quietly = TRUE)
# Create a network.
net = as_sfnetwork(roxel)
# Use query function in a filter call.
filtered = net %>%
activate("nodes") %>%
filter(node_X() > 7.54)
oldpar = par(no.readonly = TRUE)
par(mar = c(1,1,1,1))
plot(net, col = "grey")
plot(filtered, col = "red", add = TRUE)
par(oldpar)
# Use query function in a mutate call.
net %>%
activate("nodes") %>%
mutate(X = node_X(), Y = node_Y())
Run the code above in your browser using DataLab