[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] vertex attribute assignment matching names

From: Louis Aslett
Subject: Re: [igraph] vertex attribute assignment matching names
Date: Mon, 17 Sep 2012 11:32:20 +0100

Maybe something like:

V(g)$size <- my.data.frame$size[match(my.data.frame$name, V(g)$name)]


On 17 September 2012 11:23, Bob Pap <address@hidden> wrote:
Dear all,
I found no help in the relevant pages for assigning vertex attributed _making sure that names are properly matched.  Example, V(g)$name lists 50 cities in a non-alphabetical order, whereas I have a data.frame with 50 lines and a 'name' column in alphabetical order having as columns additional vertex attreibutes I would like to assign.
Simply doing V(g)$size <- my.data.frame$size does not (as far as I can read from the help pages) guarantee that cities are properly matched by name (V(g)$name and my.data.frame$name respectively).
How can I specify that names are correctly mapped? Any suggestion is appreciated.
Kind regards,

igraph-help mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]