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 <[email protected]> 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 <[email protected]> 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 >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/igraph-help >> >> > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > >
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
