igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] vertex attribute assignment matching names


From: Bob Pap
Subject: Re: [igraph] vertex attribute assignment matching names
Date: Mon, 17 Sep 2012 12:46:58 +0200

Dear Louis,
 
Many thanks!  Was not familiar with the match function - it did the trick.
 
Kind regards,
Bob

On Mon, Sep 17, 2012 at 12:32 PM, Louis Aslett <address@hidden> wrote:
Maybe something like:

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

Louis


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,
Bob

_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

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