wrap_igraph | R Documentation |
Since sfnetwork
objects inherit igraph
objects, any igraph function can be called on a sfnetwork. However, if this
function returns a network, it will be an igraph object rather than a
sfnetwork object. With wrap_igraph
, such a function will
preserve the sfnetwork class, after checking if the network returned by
igraph still has a valid spatial network structure.
wrap_igraph(.data, .f, ..., .force = FALSE, .message = TRUE)
.data |
An object of class |
.f |
An function from the |
... |
Arguments passed on to |
.force |
Should network validity checks be skipped? Defaults to
|
.message |
Should informational messages (those messages that are
neither warnings nor errors) be printed when constructing the network?
Defaults to |
An object of class sfnetwork
.
oldpar = par(no.readonly = TRUE)
par(mar = c(1,1,1,1), mfrow = c(1,2))
net = as_sfnetwork(mozart, "delaunay", directed = FALSE)
mst = wrap_igraph(net, igraph::mst, .message = FALSE)
mst
plot(net)
plot(mst)
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.