最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

r - Why is the ego.attrs argument in as_igraph not converting ego information correctly? - Stack Overflow

programmeradmin1浏览0评论

I have a set of networks as egor objects in a list. When I convert them to a list of igraph objects using as_igraph, I include the ego.attrs argument to keep the data on the ego. I notice that the data is not correct when comparing between the egor and the igraph objects. Here's some reproducible code using the datasets provided by the egor package:

data("alters32")
data("egos32")
data("aaties32")
e1 <- egor(alters = alters32,
           egos = egos32,
           aaties = aaties32,
           ID.vars = list(
             ego = ".EGOID",
             alter = ".ALTID",
             source = ".SRCID",
             target = ".TGTID"))

j <- e1$ego %>%
  filter(.egoID == "4") 
j$sex
j$country
j$age
# This says w, Poland, 18-25

# Convert to igraph
igraph.egolist <- e1 %>%
  as_igraph(include.ego = TRUE,
            ego.attrs = c("sex","country", "age")) ## This lets me keep the ego attributes


h <- igraph.egolist[["4"]]
V(h)[name == "ego"]$sex 
V(h)[name == "ego"]$country 
V(h)[name == "ego"]$age 
# this says m, Germany, 56-65

Am I doing something wrong, or is this an issue with the package itself?

发布评论

评论列表(0)

  1. 暂无评论