Skip to contents

s3 method for tibble::as_tibble(). returns the same long-format frame as unnetify() / tidy.netify(), wrapped in a tibble for tidyverse-pipe friendliness.

Usage

as_tibble.netify(x, ...)

Arguments

x

a netify object.

...

passed to unnetify() (e.g., remove_zeros = TRUE).

Value

a tibble (or data.frame if tibble isn't installed) with one row per dyad. includes from, to, optional time/layer, the edge weight, dyadic covariates, and nodal covariates merged in with _from / _to suffixes.

Details

registered against the tibble::as_tibble generic via .onload, so tibble is not a hard dependency. when tibble isn't installed, a plain data.frame is returned.

See also

tidy.netify() for the broom-style sibling and unnetify() for the underlying converter.

Author

cassy dorff, shahryar minhas

Examples

# \donttest{
data(icews)
icews_10 <- icews[icews$year == 2010, ]
net <- netify(icews_10, actor1 = "i", actor2 = "j",
    symmetric = FALSE, weight = "verbCoop")
tibble::as_tibble(net)
#> # A tibble: 22,952 × 3
#>    from        to         verbCoop
#>    <chr>       <chr>         <dbl>
#>  1 Afghanistan Albania           0
#>  2 Afghanistan Algeria           0
#>  3 Afghanistan Angola            0
#>  4 Afghanistan Argentina         1
#>  5 Afghanistan Armenia           7
#>  6 Afghanistan Australia       125
#>  7 Afghanistan Austria           1
#>  8 Afghanistan Azerbaijan        7
#>  9 Afghanistan Bahrain           3
#> 10 Afghanistan Bangladesh       14
#> # ℹ 22,942 more rows
# }