You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not entirely sure of what you are trying to do, but perhaps look into left_join? Here is how I frequently use it because my nodes will have a node attribute:
library(tidygraph)
library(tidyverse)
# make a tygrsbm<- play_blocks(100, 100, 0.1) %N>%
mutate(name=1:n())
# node datanode_data<- tibble(x= rnorm(100), y= rnorm(100)) %>%
mutate(name=1:n())
# join to nodessbm<- left_join(sbm, node_data, by="name")
sbm#> # A tbl_graph: 100 nodes and 960 edges#> ##> # A directed simple graph with 1 component#> ##> # Node Data: 100 x 3 (active)#> name x y#> <int> <dbl> <dbl>#> 1 1 -0.483 0.451#> 2 2 -0.225 1.03#> 3 3 1.67 -0.196#> 4 4 0.0412 0.227#> 5 5 1.04 -1.10#> 6 6 0.588 0.955#> # … with 94 more rows#> ##> # Edge Data: 960 x 2#> from to#> <int> <int>#> 1 3 1#> 2 7 1#> 3 11 1#> # … with 957 more rows
Also look into the tidygraph::join_graph and tidygraph::bind_graph functions.
The only reason why I haven't made this available is that bind_cols is not a generic... Next feature release will probably solve this somehow with bind_node_cols etc or something like that
So far I've got the following but I'm wondering if there's a better approach:
Created on 2018-12-01 by the reprex package (v0.2.1)
The text was updated successfully, but these errors were encountered: