Query sf attributes from the active element of a sfnetwork
sf_attr(x, name, active = NULL)
An object of class sfnetwork
.
Name of the attribute to query. Either 'sf_column'
or
'agr'
.
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
.
The value of the attribute matched, or NULL
if no exact
match is found.
sf attributes include sf_column
(the name of the sf column)
and agr
(the attribute-geometry-relationships).
net = as_sfnetwork(roxel)
sf_attr(net, "agr", active = "edges")
#> from to name type
#> <NA> <NA> <NA> <NA>
#> Levels: constant aggregate identity
sf_attr(net, "sf_column", active = "nodes")
#> [1] "geometry"