我想从两组不同长度的节点生成一个图表。您可以在下面找到代码。
如您所见,我收到一个错误:错误:长度(从)==长度(到)不是真的!这个有解决办法吗?
感谢您的帮助!
library(DiagrammeR)
g1<- c("a","b","c")
g2<-c("d","f")
#creating a node data frame
nodes1<- create_node_df(n=length(g1),
style= "filled",
color= "lightblue",
shape= "box")
nodes2<- create_node_df(n=length(g2),
style= "filled",
color= "lightblue",
shape= "box")
edges<-create_edge_df(from = g1,
to= g2,
rel= "related",
color= "black")
Error: length(from) == length(to) is not TRUE
all_nodes<- combine_ndfs(nodes1, nodes2)
create_graph(nodes_df = all_nodes,
edges_df = edges,
directed = TRUE)