activate {tidygraph}R Documentation

Determine the context of subsequent manipulations

Description

As a tbl_graph can be considered as a collection of two linked tables it is necessary to specify which table is referenced during manipulations. The activate verb does just that and needs affects all subsequent manipulations until a new table is activated. active is a simple query function to get the currently acitve context.

Usage

activate(.data, what)

active(x)

Arguments

.data, x

A tbl_graph or a grouped_tbl_graph

what

What should get activated? Possible values are nodes or edges.

Value

A tbl_graph

Note

Activate will ungroup a grouped_tbl_graph.

Examples

gr <- create_complete(5) %>%
  activate(nodes) %>%
  mutate(class = sample(c('a', 'b'), 5, TRUE)) %>%
  activate(edges) %>%
  arrange(from)


[Package tidygraph version 1.0.0 Index]