The following works to get an igraph object from a matrix edgelist:
dat2 <- matrix(rep(seq(1,5,1), 4), nrow=10, ncol=2)
graph.edgelist( dat2 )
I tried with NA's but graph.edgelist did not allow NA's. Wouldn't
you just leave those rows out with NA's in them? An NA means there is no
edge, right?
Scott
On Wednesday, May 18, 2011 at 1:23 PM, Sebastián Daza wrote:
Hi everyone,> I have a dataset of friendship with this format:
>
> ego alter
> 4746 1 2
> 9742 1 3
> 14738 1 NA
> 4747 2 NA
> 9743 2 3
> 14739 2 1
> 4748 3 13
> 9744 3 5
> 14740 3 14
> 4749 4 NA
> 9745 4 NA
> 14741 4 NA
> 4750 5 NA
> 9746 5 13
> 14742 5 10
> 4751 6 12
> 9747 6 7
> ...
>
>
> NA means that individuals don't select any friend. Does anyone know how
> to format this dataset to use sna or igraph packages? I don't know how
> to convert it into a matrix or a edgelist in R without losing isolated
> individuals .
>
> Next question, anyone knows if there is a package to perform a Moody's
> Crowds routine to identify groups using R, or other algorithms designed
> to search groups by maximizing modularity scores?
>
> Thank you in advance!
>
> --
> Sebastián Daza
> sebastian.daza@gmail.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]