On Monday, 16 July 2012 at 19:51, Jessie Gunter wrote:
> Hello,
>
> I am using igraph to reshape a dataframe and create a graph with weighted edges between nodes. I melted the dataframe and used this...
>
> > E23_new<-data.frame(id=E23[,1],var=E23.contacts,value=E23.recode)
>
> to make the dataset look like this:
>
> > head(E23_new)
> id var value
> 1 23002 Chief 4
> 2 23003 Chief 4
> 3 23004 Chief 3
> 4 23005 Chief 3
> 5 23006 Chief 3
> 6 23007 Chief 2
>
> I am trying to make the "value" column the edge weights. I had no luck with this:
>
> g <- set.edge.attribute(g, "weight", value=E23.recode)
>
> How can I weight the edges according to the number in the value column? Right now they are all weighted 1.0.
>
> Any help would be greatly appreciated. Thanks in advance.
>
> -Jessie
> _______________________________________________