Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从r中的数据帧创建图形_R_Dataframe_Networking_Graph_Igraph - Fatal编程技术网

从r中的数据帧创建图形

从r中的数据帧创建图形,r,dataframe,networking,graph,igraph,R,Dataframe,Networking,Graph,Igraph,我有一个代表grn网络的数据框。如果第3列(链接)设置为1,则第1列中的基因连接到第2列中的基因。我运行了这段代码,但生成的图形不正确 x <- data.frame("g1" = c(1,1,1,2,2,3), "g2" = c(2,3,4,3,4,4), "link" = c(1,0,1,1,0,0)) g = graph_from_data_frame(x,x$link==1) tkplot(g) x必须以这种方式定义数据帧 g=data.frame("g1"=c(1,1

我有一个代表grn网络的数据框。如果第3列(链接)设置为1,则第1列中的基因连接到第2列中的基因。我运行了这段代码,但生成的图形不正确

  x <- data.frame("g1" = c(1,1,1,2,2,3), "g2" = c(2,3,4,3,4,4), "link" = c(1,0,1,1,0,0))
  g = graph_from_data_frame(x,x$link==1)
 tkplot(g)

x必须以这种方式定义数据帧

g=data.frame("g1"=c(1,1,2), "g2" = c(2,4,3))

g=graph.data.frame(g)

您必须以这种方式定义数据帧

g=data.frame("g1"=c(1,1,2), "g2" = c(2,4,3))

g=graph.data.frame(g)