我想使用 igraph 来探索一些网络数据。我的数据具有以下结构:
a <- c(13, 32, NA, NA)
b <- c(32, NA, NA, NA)
c <- c(34, 13, 32, NA)
d <- c(5, NA, NA, NA)
net <- rbind(a, b, c, d)
第一列:焦点主题 ID
从 2 到 4 列:来自焦点主体的接收器
在剧情中,对象 5 应该被隔离。
library(reshape)
library(igraph)
net <- as.data.frame(net)
mdata <- melt(net, id=c("V1"))
g <- graph.data.frame(mdata[,c(1,3)])
Warning message:
In graph.data.frame(mdata[, c(1, 3)]) :
In `d' `NA' elements were replaced with string "NA"
plot(g)
正如预期的那样,NA 显示为节点。关于如何处理这个问题有什么想法吗?