as_tibble | R Documentation |
The sfnetwork method for as_tibble
is conceptually
different. Whenever a geometry list column is present, it will by default
return what we call a 'spatial tibble'. With that we mean an object of
class c('sf', 'tbl_df')
instead of an object of class
'tbl_df'
. This little conceptual trick is essential for how
tidyverse functions handle sfnetwork
objects, i.e. always
using the corresponding sf
method if present. When using
as_tibble
on sfnetwork
objects directly
as a user, you can disable this behaviour by setting spatial = FALSE
.
## S3 method for class 'sfnetwork'
as_tibble(x, active = NULL, spatial = TRUE, ...)
x |
An object of class |
active |
Which network element (i.e. nodes or edges) to activate before
extracting. If |
spatial |
Should the extracted tibble be a 'spatial tibble', i.e. an
object of class |
... |
Arguments passed on to |
The active element of the network as an object of class
tibble
.
library(tibble, quietly = TRUE)
net = as_sfnetwork(roxel)
# Extract the active network element as a spatial tibble.
as_tibble(net)
# Extract any network element as a spatial tibble.
as_tibble(net, "edges")
# Extract the active network element as a regular tibble.
as_tibble(net, spatial = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.