tidygraph
methods for
sfnetwork
objects. Since sfnetwork
objects
subclass tbl_graph
objects, most tidygraph
functions work automatically. However, some of them need a special method,
mostly as a result of the presence of the geometry list column in
sfnetwork
objects. Use these methods without the .sfnetwork
suffix and after loading the tidygraph package.
# S3 method for sfnetwork
as_tbl_graph(x, ...)# S3 method for sfnetwork
as_tibble(x, active = NULL, spatial = TRUE, ...)
# S3 method for sfnetwork
morph(.data, .f, ...)
# S3 method for sfnetwork
mutate(.data, ...)
# S3 method for sfnetwork
select(.data, ...)
An object of class sfnetwork
.
Arguments passed on the corresponding tidygraph
function.
Which network element (i.e. nodes or edges) to activate before
extracting. If NULL
, it will be set to the current active element of
the given network. Defaults to NULL
.
Should te extracted tibble be a 'spatial tibble', i.e. an
object of class c('sf', 'tbl_df')
, if it contains a geometry list
column. Defaults to TRUE
.
An object of class sfnetwork
.
See morph
.
as_tibble.sfnetwork
: The sfnetwork method for
as_tibble
differs in the sense that whenever a
geometry list column is present, by default it will return a
'spatial tibble'. With that we mean an object of class
c('sf', 'tbl_df')
instead of an object of class 'tbl_df'
.
morph.sfnetwork
: The sfnetwork method for
morph
will first try to input the
sfnetwork
object into the morph method for a
tbl_graph
. If this fails, it will first convert
the sfnetwork
object into a tbl_graph
object before calling morph
. The returned value
will be a morphed_sfnetwork
when all elements of the morphed graph
are of class sfnetwork
, and a morphed_tbl_graph
otherwise.
mutate.sfnetwork
: The sfnetwork method for mutate
works the same, but updates the sf attributes of the resulting network.
select.sfnetwork
: The sfnetwork method for select
works the same, but updates the sf attributes of the resulting network.
See the tidygraph
documentation.